CMS 3D CMS Logo

PFBlockProducer.cc
Go to the documentation of this file.
7 
19 class FSimEvent;
20 
22 public:
23  explicit PFBlockProducer(const edm::ParameterSet&);
24 
25  void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
26 
27  void produce(edm::Event&, const edm::EventSetup&) override;
28  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
29 
30 private:
32  const bool verbose_;
34 
37 };
38 
39 DEFINE_FWK_MODULE(PFBlockProducer);
40 
43  // verbosity
44  desc.addUntracked<bool>("verbose", false);
45  // Debug flag
46  desc.addUntracked<bool>("debug", false);
47  //define what we are importing into particle flow
48  //from the various subdetectors
49  // importers are executed in the order they are defined here!!!
50  //order matters for some modules (it is pointed out where this is important)
51  // you can find a list of all available importers in:
52  // plugins/importers
53  {
54  std::vector<edm::ParameterSet> vpset;
55  vpset.reserve(12);
56  {
58  pset.addParameter<std::string>("importerName", "GSFTrackImporter");
59  pset.addParameter<edm::InputTag>("source", {"pfTrackElec"});
60  pset.addParameter<bool>("gsfsAreSecondary", false);
61  pset.addParameter<bool>("superClustersArePF", true);
62  vpset.emplace_back(pset);
63  }
64  {
66  pset.addParameter<std::string>("importerName", "ConvBremTrackImporter");
67  pset.addParameter<edm::InputTag>("source", {"pfTrackElec"});
68  pset.addParameter<bool>("vetoEndcap", false);
69  vpset.emplace_back(pset);
70  }
71  {
73  pset.addParameter<std::string>("importerName", "SuperClusterImporter");
74  pset.addParameter<edm::InputTag>("source_eb",
75  {"particleFlowSuperClusterECAL:particleFlowSuperClusterECALBarrel"});
76  pset.addParameter<edm::InputTag>(
77  "source_ee", {"particleFlowSuperClusterECAL:particleFlowSuperClusterECALEndcapWithPreshower"});
78  pset.addParameter<double>("maximumHoverE", 0.5);
79  pset.addParameter<double>("minSuperClusterPt", 10.0);
80  pset.addParameter<double>("minPTforBypass", 100.0);
81  pset.addParameter<edm::InputTag>("hbheRecHitsTag", {"hbhereco"});
82  pset.addParameter<int>("maxSeverityHB", 9);
83  pset.addParameter<int>("maxSeverityHE", 9);
84  pset.addParameter<bool>("usePFThresholdsFromDB", false);
85  pset.addParameter<bool>("superClustersArePF", true);
86  vpset.emplace_back(pset);
87  }
88  {
90  pset.addParameter<std::string>("importerName", "ConversionTrackImporter");
91  pset.addParameter<edm::InputTag>("source", {"pfConversions"});
92  pset.addParameter<bool>("vetoEndcap", false);
93  vpset.emplace_back(pset);
94  }
95  // V0's not actually used in particle flow block building so far
96  //NuclearInteraction's also come in Loose and VeryLoose varieties
97  {
99  pset.addParameter<std::string>("importerName", "NuclearInteractionTrackImporter");
100  pset.addParameter<edm::InputTag>("source", {"pfDisplacedTrackerVertex"});
101  pset.addParameter<bool>("vetoEndcap", false);
102  vpset.emplace_back(pset);
103  }
104  //for best timing GeneralTracksImporter should come after
105  // all secondary track importers
106  {
108  pset.addParameter<std::string>("importerName", "GeneralTracksImporter");
109  pset.addParameter<edm::InputTag>("source", {"pfTrack"});
110  pset.addParameter<bool>("vetoEndcap", false);
111  pset.addParameter<edm::InputTag>("muonSrc", {"muons1stStep"});
112  pset.addParameter<std::string>("trackQuality", "highPurity");
113  pset.addParameter<bool>("cleanBadConvertedBrems", true);
114  pset.addParameter<bool>("useIterativeTracking", true);
115  pset.addParameter<std::vector<double>>("DPtOverPtCuts_byTrackAlgo", {10.0, 10.0, 10.0, 10.0, 10.0, 5.0});
116  pset.addParameter<std::vector<uint32_t>>("NHitCuts_byTrackAlgo", {3, 3, 3, 3, 3, 3});
117  pset.addParameter<double>("muonMaxDPtOPt", 1);
118  vpset.emplace_back(pset);
119  }
120  // secondary GSF tracks are also turned off
121  // to properly set SC based links you need to run ECAL importer
122  // after you've imported all SCs to the block
123  {
125  pset.addParameter<std::string>("importerName", "ECALClusterImporter");
126  pset.addParameter<edm::InputTag>("source", {"particleFlowClusterECAL"});
127  pset.addParameter<edm::InputTag>("BCtoPFCMap", {"particleFlowSuperClusterECAL:PFClusterAssociationEBEE"});
128  vpset.emplace_back(pset);
129  }
130  {
132  pset.addParameter<std::string>("importerName", "GenericClusterImporter");
133  pset.addParameter<edm::InputTag>("source", {"particleFlowClusterHCAL"});
134  vpset.emplace_back(pset);
135  }
136  {
138  pset.addParameter<std::string>("importerName", "GenericClusterImporter");
139  pset.addParameter<edm::InputTag>("source", {"particleFlowBadHcalPseudoCluster"});
140  vpset.emplace_back(pset);
141  }
142  {
144  pset.addParameter<std::string>("importerName", "GenericClusterImporter");
145  pset.addParameter<edm::InputTag>("source", {"particleFlowClusterHO"});
146  vpset.emplace_back(pset);
147  }
148  {
150  pset.addParameter<std::string>("importerName", "GenericClusterImporter");
151  pset.addParameter<edm::InputTag>("source", {"particleFlowClusterHF"});
152  vpset.emplace_back(pset);
153  }
154  {
156  pset.addParameter<std::string>("importerName", "GenericClusterImporter");
157  pset.addParameter<edm::InputTag>("source", {"particleFlowClusterPS"});
158  vpset.emplace_back(pset);
159  }
161  psd.add<std::string>("importerName", "");
162  psd.add<edm::InputTag>("source", {});
163  psd.add<bool>("gsfsAreSecondary", false);
164  psd.add<bool>("superClustersArePF", false);
165  psd.add<edm::InputTag>("source_eb", {});
166  psd.add<edm::InputTag>("source_ee", {});
167  psd.add<double>("maximumHoverE", 0);
168  psd.add<double>("minSuperClusterPt", 0);
169  psd.add<double>("minPTforBypass", 0);
170  psd.add<edm::InputTag>("hbheRecHitsTag", {});
171  psd.add<int>("maxSeverityHB", 0);
172  psd.add<int>("maxSeverityHE", 0);
173  psd.add<bool>("usePFThresholdsFromDB", false);
174  psd.add<bool>("vetoEndcap", false);
175  psd.add<edm::InputTag>("muonSrc", {});
176  psd.add<std::string>("trackQuality", "");
177  psd.add<bool>("cleanBadConvertedBrems", false);
178  psd.add<bool>("useIterativeTracking", false);
179  psd.add<std::vector<double>>("DPtOverPtCuts_byTrackAlgo", {});
180  psd.add<std::vector<uint32_t>>("NHitCuts_byTrackAlgo", {});
181  psd.add<double>("muonMaxDPtOPt", 0);
182  psd.add<edm::InputTag>("BCtoPFCMap", {});
183  psd.add<double>("maxDPtOPt", 0);
184  psd.add<uint32_t>("vetoMode", 0);
185  psd.add<edm::InputTag>("vetoSrc", {});
186  psd.add<edm::InputTag>("timeValueMap", {});
187  psd.add<edm::InputTag>("timeErrorMap", {});
188  psd.add<edm::InputTag>("timeQualityMap", {});
189  psd.add<double>("timeQualityThreshold", 0);
190  psd.add<edm::InputTag>("timeValueMapGsf", {});
191  psd.add<edm::InputTag>("timeErrorMapGsf", {});
192  psd.add<edm::InputTag>("timeQualityMapGsf", {});
193  psd.add<bool>("useTimeQuality", false);
194  desc.addVPSet("elementImporters", psd, vpset);
195  }
196  //linking definitions
197  // you can find a list of all available linkers in:
198  // plugins/linkers
199  // see : plugins/kdtrees for available KDTree Types
200  // to enable a KDTree for a linking pair, write a KDTree linker
201  // and set useKDTree = True in the linker PSet
202  //order does not matter here since we are defining a lookup table
203  {
204  std::vector<edm::ParameterSet> vpset;
205  vpset.reserve(18);
206  {
208  pset.addParameter<std::string>("linkerName", "PreshowerAndECALLinker");
209  pset.addParameter<std::string>("linkType", "PS1:ECAL");
210  pset.addParameter<bool>("useKDTree ", true);
211  vpset.emplace_back(pset);
212  }
213  {
215  pset.addParameter<std::string>("linkerName", "PreshowerAndECALLinker");
216  pset.addParameter<std::string>("linkType", "PS2:ECAL");
217  pset.addParameter<bool>("useKDTree ", true);
218  vpset.emplace_back(pset);
219  }
220  {
222  pset.addParameter<std::string>("linkerName", "TrackAndECALLinker");
223  pset.addParameter<std::string>("linkType", "TRACK:ECAL");
224  pset.addParameter<bool>("useKDTree ", true);
225  vpset.emplace_back(pset);
226  }
227  {
229  pset.addParameter<std::string>("linkerName", "TrackAndHCALLinker");
230  pset.addParameter<std::string>("linkType", "TRACK:HCAL");
231  pset.addParameter<bool>("useKDTree", true);
232  pset.addParameter<std::string>("trajectoryLayerEntrance", "HCALEntrance");
233  pset.addParameter<std::string>("trajectoryLayerExit", "HCALExit");
234  pset.addParameter<int>("nMaxHcalLinksPerTrack",
235  1); // the max hcal links per track (negative values: no restriction)
236  vpset.emplace_back(pset);
237  }
238  {
240  pset.addParameter<std::string>("linkerName", "TrackAndHOLinker");
241  pset.addParameter<std::string>("linkType", "TRACK:HO");
242  pset.addParameter<bool>("useKDTree", false);
243  vpset.emplace_back(pset);
244  }
245  {
247  pset.addParameter<std::string>("linkerName", "ECALAndHCALLinker");
248  pset.addParameter<std::string>("linkType", "ECAL:HCAL");
249  pset.addParameter<double>("minAbsEtaEcal", 2.5);
250  pset.addParameter<bool>("useKDTree", false);
251  vpset.emplace_back(pset);
252  }
253  {
255  pset.addParameter<std::string>("linkerName", "HCALAndHOLinker");
256  pset.addParameter<std::string>("linkType", "HCAL:HO");
257  pset.addParameter<bool>("useKDTree", false);
258  vpset.emplace_back(pset);
259  }
260  {
262  pset.addParameter<std::string>("linkerName", "HFEMAndHFHADLinker");
263  pset.addParameter<std::string>("linkType", "HFEM:HFHAD");
264  pset.addParameter<bool>("useKDTree", false);
265  vpset.emplace_back(pset);
266  }
267  {
269  pset.addParameter<std::string>("linkerName", "TrackAndTrackLinker");
270  pset.addParameter<std::string>("linkType", "TRACK:TRACK");
271  pset.addParameter<bool>("useKDTree", false);
272  vpset.emplace_back(pset);
273  }
274  {
276  pset.addParameter<std::string>("linkerName", "ECALAndECALLinker");
277  pset.addParameter<std::string>("linkType", "ECAL:ECAL");
278  pset.addParameter<bool>("useKDTree", false);
279  vpset.emplace_back(pset);
280  }
281  {
283  pset.addParameter<std::string>("linkerName", "GSFAndECALLinker");
284  pset.addParameter<std::string>("linkType", "GSF:ECAL");
285  pset.addParameter<bool>("useKDTree", false);
286  vpset.emplace_back(pset);
287  }
288  {
290  pset.addParameter<std::string>("linkerName", "TrackAndGSFLinker");
291  pset.addParameter<std::string>("linkType", "TRACK:GSF");
292  pset.addParameter<bool>("useKDTree", false);
293  pset.addParameter<bool>("useConvertedBrems", true);
294  vpset.emplace_back(pset);
295  }
296  {
298  pset.addParameter<std::string>("linkerName", "GSFAndBREMLinker");
299  pset.addParameter<std::string>("linkType", "GSF:BREM");
300  pset.addParameter<bool>("useKDTree", false);
301  vpset.emplace_back(pset);
302  }
303  {
305  pset.addParameter<std::string>("linkerName", "GSFAndGSFLinker");
306  pset.addParameter<std::string>("linkType", "GSF:GSF");
307  pset.addParameter<bool>("useKDTree", false);
308  vpset.emplace_back(pset);
309  }
310  {
312  pset.addParameter<std::string>("linkerName", "ECALAndBREMLinker");
313  pset.addParameter<std::string>("linkType", "ECAL:BREM");
314  pset.addParameter<bool>("useKDTree", false);
315  vpset.emplace_back(pset);
316  }
317  {
319  pset.addParameter<std::string>("linkerName", "GSFAndHCALLinker");
320  pset.addParameter<std::string>("linkType", "GSF:HCAL");
321  pset.addParameter<bool>("useKDTree", false);
322  vpset.emplace_back(pset);
323  }
324  {
326  pset.addParameter<std::string>("linkerName", "HCALAndBREMLinker");
327  pset.addParameter<std::string>("linkType", "HCAL:BREM");
328  pset.addParameter<bool>("useKDTree", false);
329  vpset.emplace_back(pset);
330  }
331  {
333  pset.addParameter<std::string>("linkerName", "SCAndECALLinker");
334  pset.addParameter<std::string>("linkType", "SC:ECAL");
335  pset.addParameter<bool>("useKDTree", false);
336  pset.addParameter<bool>("SuperClusterMatchByRef", true);
337  vpset.emplace_back(pset);
338  }
340  psd.add<std::string>("linkerName", "");
341  psd.add<std::string>("linkType", "");
342  psd.add<bool>("useKDTree", false);
343  psd.add<std::string>("trajectoryLayerEntrance", "");
344  psd.add<std::string>("trajectoryLayerExit", "");
345  psd.add<int>("nMaxHcalLinksPerTrack", 0);
346  psd.add<double>("minAbsEtaEcal", 0);
347  psd.add<bool>("useConvertedBrems", false);
348  psd.add<bool>("SuperClusterMatchByRef", false);
349  desc.addVPSet("linkDefinitions", psd, vpset);
350  }
351  descriptions.addWithDefaultLabel(desc);
352 }
353 
354 using namespace std;
355 using namespace edm;
356 
358  : verbose_{iConfig.getUntrackedParameter<bool>("verbose", false)}, putToken_{produces<reco::PFBlockCollection>()} {
359  bool debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
360  pfBlockAlgo_.setDebug(debug_);
361 
362  edm::ConsumesCollector cc = consumesCollector();
363  const std::vector<edm::ParameterSet>& importers = iConfig.getParameterSetVector("elementImporters");
364  pfBlockAlgo_.setImporters(importers, cc);
365 
366  const std::vector<edm::ParameterSet>& linkdefs = iConfig.getParameterSetVector("linkDefinitions");
367  pfBlockAlgo_.setLinkers(linkdefs);
368 }
369 
371  pfBlockAlgo_.updateEventSetup(es);
372 }
373 
375  pfBlockAlgo_.buildElements(iEvent);
376 
377  auto blocks = pfBlockAlgo_.findBlocks();
378 
379  if (verbose_) {
380  ostringstream str;
381  str << pfBlockAlgo_ << endl;
382  str << "number of blocks : " << blocks.size() << endl;
383  str << endl;
384 
385  for (auto const& block : blocks) {
386  str << block << endl;
387  }
388 
389  LogInfo("PFBlockProducer") << str.str() << endl;
390  }
391 
392  iEvent.emplace(putToken_, blocks);
393 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
const edm::EDPutTokenT< reco::PFBlockCollection > putToken_
PFBlockProducer(const edm::ParameterSet &)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Particle Flow Algorithm.
Definition: PFBlockAlgo.h:34
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
PFBlockAlgo pfBlockAlgo_
Particle flow block algorithm.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const bool verbose_
verbose ?
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Log< level::Info, false > LogInfo
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
#define str(s)