CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
PFProducer Class Reference

Producer for particle flow reconstructed particles (PFCandidates) More...

#include <PFProducer.h>

Inheritance diagram for PFProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 PFProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string electronExtraOutputCol_
 
std::string electronOutputCol_
 
edm::InputTag inputTagBlocks_
 
std::vector< edm::InputTaginputTagCleanedHF_
 
edm::InputTag inputTagEgammaElectrons_
 
edm::InputTag inputTagMuons_
 
std::auto_ptr< PFAlgopfAlgo_
 particle flow algorithm More...
 
std::string photonExtraOutputCol_
 
bool postMuonCleaning_
 
const GBRForestReaderEcalRes_
 
const GBRForestReaderGC_
 
const GBRForestReaderGCBarrel_
 
const GBRForestReaderGCEndCapHighr9_
 
const GBRForestReaderGCEndCapLowr9_
 
const GBRForestReaderLC_
 
const GBRForestReaderLCEB_
 
const GBRForestReaderLCEE_
 
const GBRForestReaderRes_
 
bool useCalibrationsFromDB_
 
bool useEGammaElectrons_
 
bool useHO_
 
bool usePFElectrons_
 
bool usePFPhotons_
 
bool usePhotonReg_
 
bool useRegressionFromDB_
 
bool useVerticesForNeutral_
 
bool verbose_
 verbose ? More...
 
edm::InputTag vertices_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Producer for particle flow reconstructed particles (PFCandidates)

This producer makes use of PFAlgo, the particle flow algorithm.

Author
Colin Bernet
Date
July 2006

Definition at line 30 of file PFProducer.h.

Constructor & Destructor Documentation

PFProducer::PFProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 31 of file PFProducer.cc.

References funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

31  {
32 
33  //--ab: get calibration factors for HF:
34  bool calibHF_use;
35  std::vector<double> calibHF_eta_step;
36  std::vector<double> calibHF_a_EMonly;
37  std::vector<double> calibHF_b_HADonly;
38  std::vector<double> calibHF_a_EMHAD;
39  std::vector<double> calibHF_b_EMHAD;
40  calibHF_use = iConfig.getParameter<bool>("calibHF_use");
41  calibHF_eta_step = iConfig.getParameter<std::vector<double> >("calibHF_eta_step");
42  calibHF_a_EMonly = iConfig.getParameter<std::vector<double> >("calibHF_a_EMonly");
43  calibHF_b_HADonly = iConfig.getParameter<std::vector<double> >("calibHF_b_HADonly");
44  calibHF_a_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_a_EMHAD");
45  calibHF_b_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_b_EMHAD");
46  boost::shared_ptr<PFEnergyCalibrationHF>
47  thepfEnergyCalibrationHF ( new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
48  //-----------------
49 
51  = iConfig.getParameter<InputTag>("blocks");
52 
53  //Post cleaning of the muons
55  = iConfig.getParameter<InputTag>("muons");
57  = iConfig.getParameter<bool>("postMuonCleaning");
58 
60  = iConfig.getParameter<bool>("usePFElectrons");
61 
63  = iConfig.getParameter<bool>("usePFPhotons");
64 
66  = (usePFPhotons_) ? iConfig.getParameter<bool>("usePhotonReg") : false ;
67 
69  = (usePFPhotons_) ? iConfig.getParameter<bool>("useRegressionFromDB") : false;
70 
72  = iConfig.getParameter<bool>("useEGammaElectrons");
73 
74  if( useEGammaElectrons_) {
75  inputTagEgammaElectrons_ = iConfig.getParameter<edm::InputTag>("egammaElectrons");
76  }
77 
79  = iConfig.getParameter<std::string>("pf_electron_output_col");
80 
81  bool usePFSCEleCalib;
82  std::vector<double> calibPFSCEle_Fbrem_barrel;
83  std::vector<double> calibPFSCEle_Fbrem_endcap;
84  std::vector<double> calibPFSCEle_barrel;
85  std::vector<double> calibPFSCEle_endcap;
86  usePFSCEleCalib = iConfig.getParameter<bool>("usePFSCEleCalib");
87  calibPFSCEle_Fbrem_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_barrel");
88  calibPFSCEle_Fbrem_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_endcap");
89  calibPFSCEle_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_barrel");
90  calibPFSCEle_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_endcap");
91  boost::shared_ptr<PFSCEnergyCalibration>
92  thePFSCEnergyCalibration ( new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
93  calibPFSCEle_barrel,calibPFSCEle_endcap ));
94 
95  bool useEGammaSupercluster = iConfig.getParameter<bool>("useEGammaSupercluster");
96  double sumEtEcalIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_barrel");
97  double sumEtEcalIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_endcap");
98  double coneEcalIsoForEgammaSC = iConfig.getParameter<double>("coneEcalIsoForEgammaSC");
99  double sumPtTrackIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_barrel");
100  double sumPtTrackIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_endcap");
101  double coneTrackIsoForEgammaSC = iConfig.getParameter<double>("coneTrackIsoForEgammaSC");
102  unsigned int nTrackIsoForEgammaSC = iConfig.getParameter<unsigned int>("nTrackIsoForEgammaSC");
103 
104 
105  // register products
106  produces<reco::PFCandidateCollection>();
107  produces<reco::PFCandidateCollection>("CleanedHF");
108  produces<reco::PFCandidateCollection>("CleanedCosmicsMuons");
109  produces<reco::PFCandidateCollection>("CleanedTrackerAndGlobalMuons");
110  produces<reco::PFCandidateCollection>("CleanedFakeMuons");
111  produces<reco::PFCandidateCollection>("CleanedPunchThroughMuons");
112  produces<reco::PFCandidateCollection>("CleanedPunchThroughNeutralHadrons");
113  produces<reco::PFCandidateCollection>("AddedMuonsAndHadrons");
114 
115 
116  if (usePFElectrons_) {
117  produces<reco::PFCandidateCollection>(electronOutputCol_);
118  produces<reco::PFCandidateElectronExtraCollection>(electronExtraOutputCol_);
119  }
120 
121  if (usePFPhotons_) {
122  produces<reco::PFCandidatePhotonExtraCollection>(photonExtraOutputCol_);
123  }
124 
125 
126  double nSigmaECAL
127  = iConfig.getParameter<double>("pf_nsigma_ECAL");
128  double nSigmaHCAL
129  = iConfig.getParameter<double>("pf_nsigma_HCAL");
130 
131  //PFElectrons Configuration
132  double mvaEleCut
133  = iConfig.getParameter<double>("pf_electron_mvaCut");
134 
135 
136  string mvaWeightFileEleID
137  = iConfig.getParameter<string>("pf_electronID_mvaWeightFile");
138 
139  bool applyCrackCorrectionsForElectrons
140  = iConfig.getParameter<bool>("pf_electronID_crackCorrection");
141 
142  string path_mvaWeightFileEleID;
143  if(usePFElectrons_)
144  {
145  path_mvaWeightFileEleID = edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
146  }
147 
148  //PFPhoton Configuration
149 
150  string path_mvaWeightFileConvID;
151  string mvaWeightFileConvID;
152  string path_mvaWeightFileGCorr;
153  string path_mvaWeightFileLCorr;
154  string path_X0_Map;
155  string path_mvaWeightFileRes;
156  double mvaConvCut=-99.;
157  double sumPtTrackIsoForPhoton = 99.;
158  double sumPtTrackIsoSlopeForPhoton = 99.;
159 
160  if(usePFPhotons_ )
161  {
162  mvaWeightFileConvID =iConfig.getParameter<string>("pf_convID_mvaWeightFile");
163  mvaConvCut = iConfig.getParameter<double>("pf_conv_mvaCut");
164  path_mvaWeightFileConvID = edm::FileInPath ( mvaWeightFileConvID.c_str() ).fullPath();
165  sumPtTrackIsoForPhoton = iConfig.getParameter<double>("sumPtTrackIsoForPhoton");
166  sumPtTrackIsoSlopeForPhoton = iConfig.getParameter<double>("sumPtTrackIsoSlopeForPhoton");
167 
168  string X0_Map=iConfig.getParameter<string>("X0_Map");
169  path_X0_Map = edm::FileInPath( X0_Map.c_str() ).fullPath();
170 
171  if(!useRegressionFromDB_) {
172  string mvaWeightFileLCorr=iConfig.getParameter<string>("pf_locC_mvaWeightFile");
173  path_mvaWeightFileLCorr = edm::FileInPath( mvaWeightFileLCorr.c_str() ).fullPath();
174  string mvaWeightFileGCorr=iConfig.getParameter<string>("pf_GlobC_mvaWeightFile");
175  path_mvaWeightFileGCorr = edm::FileInPath( mvaWeightFileGCorr.c_str() ).fullPath();
176  string mvaWeightFileRes=iConfig.getParameter<string>("pf_Res_mvaWeightFile");
177  path_mvaWeightFileRes=edm::FileInPath(mvaWeightFileRes.c_str()).fullPath();
178 
179  TFile *fgbr = new TFile(path_mvaWeightFileGCorr.c_str(),"READ");
180  ReaderGC_ =(const GBRForest*)fgbr->Get("GBRForest");
181  TFile *fgbr2 = new TFile(path_mvaWeightFileLCorr.c_str(),"READ");
182  ReaderLC_ = (const GBRForest*)fgbr2->Get("GBRForest");
183  TFile *fgbr3 = new TFile(path_mvaWeightFileRes.c_str(),"READ");
184  ReaderRes_ = (const GBRForest*)fgbr3->Get("GBRForest");
185  LogDebug("PFProducer")<<"Will set regressions from binary files " <<endl;
186  }
187 
188  }
189 
190 
191  //Secondary tracks and displaced vertices parameters
192 
193  bool rejectTracks_Bad
194  = iConfig.getParameter<bool>("rejectTracks_Bad");
195 
196  bool rejectTracks_Step45
197  = iConfig.getParameter<bool>("rejectTracks_Step45");
198 
199  bool usePFNuclearInteractions
200  = iConfig.getParameter<bool>("usePFNuclearInteractions");
201 
202  bool usePFConversions
203  = iConfig.getParameter<bool>("usePFConversions");
204 
205  bool usePFDecays
206  = iConfig.getParameter<bool>("usePFDecays");
207 
208  double dptRel_DispVtx
209  = iConfig.getParameter<double>("dptRel_DispVtx");
210 
211  edm::ParameterSet iCfgCandConnector
212  = iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector");
213 
214 
215  // fToRead = iConfig.getUntrackedParameter<vector<string> >("toRead");
216 
218  = iConfig.getParameter<bool>("useCalibrationsFromDB");
219 
220  boost::shared_ptr<PFEnergyCalibration>
221  calibration( new PFEnergyCalibration() );
222 
223  int algoType
224  = iConfig.getParameter<unsigned>("algoType");
225 
226  switch(algoType) {
227  case 0:
228  pfAlgo_.reset( new PFAlgo);
229  break;
230  default:
231  assert(0);
232  }
233 
234  pfAlgo_->setParameters( nSigmaECAL,
235  nSigmaHCAL,
236  calibration,
237  thepfEnergyCalibrationHF);
238 
239  //PFElectrons: call the method setpfeleparameters
240  pfAlgo_->setPFEleParameters(mvaEleCut,
241  path_mvaWeightFileEleID,
242  usePFElectrons_,
243  thePFSCEnergyCalibration,
244  calibration,
245  sumEtEcalIsoForEgammaSC_barrel,
246  sumEtEcalIsoForEgammaSC_endcap,
247  coneEcalIsoForEgammaSC,
248  sumPtTrackIsoForEgammaSC_barrel,
249  sumPtTrackIsoForEgammaSC_endcap,
250  nTrackIsoForEgammaSC,
251  coneTrackIsoForEgammaSC,
252  applyCrackCorrectionsForElectrons,
253  usePFSCEleCalib,
255  useEGammaSupercluster);
256 
257  // pfAlgo_->setPFConversionParameters(usePFConversions);
258 
259  // PFPhotons:
260  pfAlgo_->setPFPhotonParameters(usePFPhotons_,
261  path_mvaWeightFileConvID,
262  mvaConvCut,
263  usePhotonReg_,
264  path_X0_Map,
265  calibration,
266  sumPtTrackIsoForPhoton,
267  sumPtTrackIsoSlopeForPhoton);
268 
269 
270  //Secondary tracks and displaced vertices parameters
271 
272  pfAlgo_->setDisplacedVerticesParameters(rejectTracks_Bad,
273  rejectTracks_Step45,
274  usePFNuclearInteractions,
275  usePFConversions,
276  usePFDecays,
277  dptRel_DispVtx);
278 
279  if (usePFNuclearInteractions)
280  pfAlgo_->setCandConnectorParameters( iCfgCandConnector );
281 
282 
283 
284  // Set muon and fake track parameters
285  pfAlgo_->setPFMuonAndFakeParameters(iConfig);
286 
287  //Post cleaning of the HF
288  bool postHFCleaning
289  = iConfig.getParameter<bool>("postHFCleaning");
290  double minHFCleaningPt
291  = iConfig.getParameter<double>("minHFCleaningPt");
292  double minSignificance
293  = iConfig.getParameter<double>("minSignificance");
294  double maxSignificance
295  = iConfig.getParameter<double>("maxSignificance");
296  double minSignificanceReduction
297  = iConfig.getParameter<double>("minSignificanceReduction");
298  double maxDeltaPhiPt
299  = iConfig.getParameter<double>("maxDeltaPhiPt");
300  double minDeltaMet
301  = iConfig.getParameter<double>("minDeltaMet");
302 
303  // Set post HF cleaning muon parameters
304  pfAlgo_->setPostHFCleaningParameters(postHFCleaning,
305  minHFCleaningPt,
306  minSignificance,
307  maxSignificance,
308  minSignificanceReduction,
309  maxDeltaPhiPt,
310  minDeltaMet);
311 
312  // Input tags for HF cleaned rechits
314  = iConfig.getParameter< std::vector<edm::InputTag> >("cleanedHF");
315 
316  //MIKE: Vertex Parameters
317  vertices_ = iConfig.getParameter<edm::InputTag>("vertexCollection");
318  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
319 
320  // Use HO clusters and links in the PF reconstruction
321  useHO_= iConfig.getParameter<bool>("useHO");
322  pfAlgo_->setHOTag(useHO_);
323 
324  verbose_ =
325  iConfig.getUntrackedParameter<bool>("verbose",false);
326 
327  bool debug_ =
328  iConfig.getUntrackedParameter<bool>("debug",false);
329 
330  pfAlgo_->setDebug( debug_ );
331 
332 }
#define LogDebug(id)
const GBRForest * ReaderRes_
Definition: PFProducer.h:69
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string photonExtraOutputCol_
Definition: PFProducer.h:47
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:89
edm::InputTag inputTagMuons_
Definition: PFProducer.h:41
const GBRForest * ReaderLC_
Definition: PFProducer.h:68
std::vector< edm::InputTag > inputTagCleanedHF_
Definition: PFProducer.h:44
bool useCalibrationsFromDB_
Definition: PFProducer.h:83
bool useVerticesForNeutral_
Definition: PFProducer.h:80
edm::InputTag vertices_
Definition: PFProducer.h:42
bool postMuonCleaning_
Definition: PFProducer.h:56
bool useHO_
Definition: PFProducer.h:50
bool useRegressionFromDB_
Definition: PFProducer.h:66
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:40
bool usePFElectrons_
Definition: PFProducer.h:59
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:43
std::string electronOutputCol_
Definition: PFProducer.h:45
bool verbose_
verbose ?
Definition: PFProducer.h:53
std::string electronExtraOutputCol_
Definition: PFProducer.h:46
bool useEGammaElectrons_
Definition: PFProducer.h:77
bool usePFPhotons_
Definition: PFProducer.h:62
Definition: PFAlgo.h:50
bool usePhotonReg_
Definition: PFProducer.h:65
const GBRForest * ReaderGC_
Definition: PFProducer.h:67
PFProducer::~PFProducer ( )

Definition at line 336 of file PFProducer.cc.

336 {}

Member Function Documentation

void PFProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 339 of file PFProducer.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

341 {
342 
343 
344  /*
345  static map<string, PerformanceResult::ResultType> functType;
346 
347  functType["PFfa_BARREL"] = PerformanceResult::PFfa_BARREL;
348  functType["PFfa_ENDCAP"] = PerformanceResult::PFfa_ENDCAP;
349  functType["PFfb_BARREL"] = PerformanceResult::PFfb_BARREL;
350  functType["PFfb_ENDCAP"] = PerformanceResult::PFfb_ENDCAP;
351  functType["PFfc_BARREL"] = PerformanceResult::PFfc_BARREL;
352  functType["PFfc_ENDCAP"] = PerformanceResult::PFfc_ENDCAP;
353  functType["PFfaEta_BARREL"] = PerformanceResult::PFfaEta_BARREL;
354  functType["PFfaEta_ENDCAP"] = PerformanceResult::PFfaEta_ENDCAP;
355  functType["PFfbEta_BARREL"] = PerformanceResult::PFfbEta_BARREL;
356  functType["PFfbEta_ENDCAP"] = PerformanceResult::PFfbEta_ENDCAP;
357  */
358 
359  if ( useCalibrationsFromDB_ ) {
360  // Read the PFCalibration functions from the global tags.
362  es.get<PFCalibrationRcd>().get(perfH);
363 
364  const PerformancePayloadFromTFormula *pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());
365 
366  pfAlgo_->thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
367  }
368 
369  /*
370  for(vector<string>::const_iterator name = fToRead.begin(); name != fToRead.end(); ++name) {
371 
372  cout << "Function: " << *name << endl;
373  PerformanceResult::ResultType fType = functType[*name];
374  pfCalibrations->printFormula(fType);
375 
376  // evaluate it @ 10 GeV
377  float energy = 10.;
378 
379  BinningPointByMap point;
380  point.insert(BinningVariables::JetEt, energy);
381 
382  if(pfCalibrations->isInPayload(fType, point)) {
383  float value = pfCalibrations->getResult(fType, point);
384  cout << " Energy before:: " << energy << " after: " << value << endl;
385  } else cout << "outside limits!" << endl;
386 
387  }
388  */
389 
391  edm::ESHandle<GBRForest> readerPFLCEB;
392  edm::ESHandle<GBRForest> readerPFLCEE;
393  edm::ESHandle<GBRForest> readerPFGCEB;
394  edm::ESHandle<GBRForest> readerPFGCEEHR9;
395  edm::ESHandle<GBRForest> readerPFGCEELR9;
396  edm::ESHandle<GBRForest> readerPFRes;
397  es.get<GBRWrapperRcd>().get("PFLCorrectionBar",readerPFLCEB);
398  ReaderLCEB_=readerPFLCEB.product();
399  es.get<GBRWrapperRcd>().get("PFLCorrectionEnd",readerPFLCEE);
400  ReaderLCEE_=readerPFLCEE.product();
401  es.get<GBRWrapperRcd>().get("PFGCorrectionBar",readerPFGCEB);
402  ReaderGCBarrel_=readerPFGCEB.product();
403  es.get<GBRWrapperRcd>().get("PFGCorrectionEndHighR9",readerPFGCEEHR9);
404  ReaderGCEndCapHighr9_=readerPFGCEEHR9.product();
405  es.get<GBRWrapperRcd>().get("PFGCorrectionEndLowR9",readerPFGCEELR9);
406  ReaderGCEndCapLowr9_=readerPFGCEELR9.product();
407  es.get<GBRWrapperRcd>().get("PFEcalResolution",readerPFRes);
408  ReaderEcalRes_=readerPFRes.product();
409 
410  /*
411  LogDebug("PFProducer")<<"setting regressions from DB "<<endl;
412  */
413  }
414 
415  if(usePFPhotons_){
416  //pfAlgo_->setPFPhotonRegWeights(ReaderLC_, ReaderGC_, ReaderRes_);
418  }
419 }
const GBRForest * ReaderEcalRes_
Definition: PFProducer.h:75
const GBRForest * ReaderLCEB_
Definition: PFProducer.h:70
const GBRForest * ReaderGCEndCapHighr9_
Definition: PFProducer.h:73
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:89
bool useCalibrationsFromDB_
Definition: PFProducer.h:83
const GBRForest * ReaderLCEE_
Definition: PFProducer.h:71
const GBRForest * ReaderGCEndCapLowr9_
Definition: PFProducer.h:74
bool useRegressionFromDB_
Definition: PFProducer.h:66
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool usePFPhotons_
Definition: PFProducer.h:62
const GBRForest * ReaderGCBarrel_
Definition: PFProducer.h:72
void PFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 423 of file PFProducer.cc.

References gather_cfg::blocks, gather_cfg::cout, edm::EventID::event(), edm::hlt::Exception, newFWLiteAna::found, edm::Event::getByLabel(), edm::EventBase::id(), ihf, edm::HandleBase::isValid(), LogDebug, patZpeak::muons, edm::Handle< T >::product(), edm::Event::put(), and edm::EventID::run().

424  {
425 
426  LogDebug("PFProducer")<<"START event: "
427  <<iEvent.id().event()
428  <<" in run "<<iEvent.id().run()<<endl;
429 
430 
431  // Get The vertices from the event
432  // and assign dynamic vertex parameters
434  bool gotVertices = iEvent.getByLabel(vertices_,vertices);
435  if(!gotVertices) {
436  ostringstream err;
437  err<<"Cannot find vertices for this event.Continuing Without them ";
438  LogError("PFProducer")<<err.str()<<endl;
439  }
440 
441  //Assign the PFAlgo Parameters
442  pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,vertices.product());
443 
444  // get the collection of blocks
445 
447 
448  LogDebug("PFProducer")<<"getting blocks"<<endl;
449  bool found = iEvent.getByLabel( inputTagBlocks_, blocks );
450 
451  if(!found ) {
452 
453  ostringstream err;
454  err<<"cannot find blocks: "<<inputTagBlocks_;
455  LogError("PFProducer")<<err.str()<<endl;
456 
457  throw cms::Exception( "MissingProduct", err.str());
458  }
459 
460  // get the collection of muons
461 
463 
464  if ( postMuonCleaning_ ) {
465 
466  LogDebug("PFProducer")<<"getting muons"<<endl;
467  found = iEvent.getByLabel( inputTagMuons_, muons );
468  pfAlgo_->setMuonHandle(muons);
469  if(!found) {
470  ostringstream err;
471  err<<"cannot find muons: "<<inputTagMuons_;
472  LogError("PFProducer")<<err.str()<<endl;
473 
474  throw cms::Exception( "MissingProduct", err.str());
475 
476  }
477 
478  }
479 
480  if (useEGammaElectrons_) {
482 
483  LogDebug("PFProducer")<<" Reading e/gamma electrons activated "<<endl;
484  found = iEvent.getByLabel( inputTagEgammaElectrons_, egelectrons );
485 
486  if(!found) {
487  ostringstream err;
488  err<<"cannot find electrons: "<<inputTagEgammaElectrons_;
489  LogError("PFProducer")<<err.str()<<endl;
490 
491  throw cms::Exception( "MissingProduct", err.str());
492  }
493 
494  pfAlgo_->setEGElectronCollection(*egelectrons);
495  }
496 
497 
498  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
499 
500  assert( blocks.isValid() );
501 
502  pfAlgo_->reconstructParticles( blocks );
503 
504  if(verbose_) {
505  ostringstream str;
506  str<<(*pfAlgo_)<<endl;
507  // cout << (*pfAlgo_) << endl;
508  LogInfo("PFProducer") <<str.str()<<endl;
509  }
510 
511 
512  // Florian 5/01/2011
513  // Save the PFElectron Extra Collection First as to be able to create valid References
514  if(usePFElectrons_) {
515  auto_ptr< reco::PFCandidateElectronExtraCollection >
516  pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
517 
519  iEvent.put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
520  pfAlgo_->setElectronExtraRef(electronExtraProd);
521  }
522 
523  // Daniele 18/05/2011
524  // Save the PFPhoton Extra Collection First as to be able to create valid References
525  if(usePFPhotons_) {
526  auto_ptr< reco::PFCandidatePhotonExtraCollection >
527  pOutputPhotonCandidateExtraCollection( pfAlgo_->transferPhotonExtra() );
528 
530  iEvent.put(pOutputPhotonCandidateExtraCollection,photonExtraOutputCol_);
531  pfAlgo_->setPhotonExtraRef(photonExtraProd);
532  }
533 
534 
535  // Save cosmic cleaned muon candidates
536  auto_ptr< reco::PFCandidateCollection >
537  pCosmicsMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedCosmicCandidates() );
538  // Save tracker/global cleaned muon candidates
539  auto_ptr< reco::PFCandidateCollection >
540  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedTrackerAndGlobalCandidates() );
541  // Save fake cleaned muon candidates
542  auto_ptr< reco::PFCandidateCollection >
543  pFakeCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedFakeCandidates() );
544  // Save punch-through cleaned muon candidates
545  auto_ptr< reco::PFCandidateCollection >
546  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedMuonCandidates() );
547  // Save punch-through cleaned neutral hadron candidates
548  auto_ptr< reco::PFCandidateCollection >
549  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedHadronCandidates() );
550  // Save added muon candidates
551  auto_ptr< reco::PFCandidateCollection >
552  pAddedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferAddedMuonCandidates() );
553 
554  // Check HF overcleaning
556  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
558  bool foundHF = iEvent.getByLabel( inputTagCleanedHF_[ihf], hfCleaned );
559  if (!foundHF) continue;
560  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
561  hfCopy.push_back( (*hfCleaned)[jhf] );
562  }
563  }
564  pfAlgo_->checkCleaning( hfCopy );
565 
566  // Save recovered HF candidates
567  auto_ptr< reco::PFCandidateCollection >
568  pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
569 
570 
571  // Save the final PFCandidate collection
572  auto_ptr< reco::PFCandidateCollection >
573  pOutputCandidateCollection( pfAlgo_->transferCandidates() );
574 
575 
576 
577  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
578  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
579  int nC=0;
580  for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
581  nC++;
582  if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl;
583 
584  }
585 
586 
587 
588  // Write in the event
589  iEvent.put(pOutputCandidateCollection);
590  iEvent.put(pCleanedCandidateCollection,"CleanedHF");
591 
592  if ( postMuonCleaning_ ) {
593  iEvent.put(pCosmicsMuonCleanedCandidateCollection,"CleanedCosmicsMuons");
594  iEvent.put(pTrackerAndGlobalCleanedMuonCandidateCollection,"CleanedTrackerAndGlobalMuons");
595  iEvent.put(pFakeCleanedMuonCandidateCollection,"CleanedFakeMuons");
596  iEvent.put(pPunchThroughMuonCleanedCandidateCollection,"CleanedPunchThroughMuons");
597  iEvent.put(pPunchThroughHadronCleanedCandidateCollection,"CleanedPunchThroughNeutralHadrons");
598  iEvent.put(pAddedMuonCandidateCollection,"AddedMuonsAndHadrons");
599  }
600 
601  if(usePFElectrons_)
602  {
603  auto_ptr< reco::PFCandidateCollection >
604  pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
605  iEvent.put(pOutputElectronCandidateCollection,electronOutputCol_);
606 
607  }
608 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
std::string photonExtraOutputCol_
Definition: PFProducer.h:47
int ihf
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:89
edm::InputTag inputTagMuons_
Definition: PFProducer.h:41
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
std::vector< edm::InputTag > inputTagCleanedHF_
Definition: PFProducer.h:44
bool useVerticesForNeutral_
Definition: PFProducer.h:80
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
edm::InputTag vertices_
Definition: PFProducer.h:42
bool postMuonCleaning_
Definition: PFProducer.h:56
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:40
bool usePFElectrons_
Definition: PFProducer.h:59
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:43
std::string electronOutputCol_
Definition: PFProducer.h:45
bool verbose_
verbose ?
Definition: PFProducer.h:53
list blocks
Definition: gather_cfg.py:90
std::string electronExtraOutputCol_
Definition: PFProducer.h:46
bool useEGammaElectrons_
Definition: PFProducer.h:77
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:56
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
bool usePFPhotons_
Definition: PFProducer.h:62

Member Data Documentation

std::string PFProducer::electronExtraOutputCol_
private

Definition at line 46 of file PFProducer.h.

std::string PFProducer::electronOutputCol_
private

Definition at line 45 of file PFProducer.h.

edm::InputTag PFProducer::inputTagBlocks_
private

Definition at line 40 of file PFProducer.h.

std::vector<edm::InputTag> PFProducer::inputTagCleanedHF_
private

Definition at line 44 of file PFProducer.h.

edm::InputTag PFProducer::inputTagEgammaElectrons_
private

Definition at line 43 of file PFProducer.h.

edm::InputTag PFProducer::inputTagMuons_
private

Definition at line 41 of file PFProducer.h.

std::auto_ptr<PFAlgo> PFProducer::pfAlgo_
private

particle flow algorithm

Definition at line 89 of file PFProducer.h.

std::string PFProducer::photonExtraOutputCol_
private

Definition at line 47 of file PFProducer.h.

bool PFProducer::postMuonCleaning_
private

Definition at line 56 of file PFProducer.h.

const GBRForest* PFProducer::ReaderEcalRes_
private

Definition at line 75 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGC_
private

Definition at line 67 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCBarrel_
private

Definition at line 72 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapHighr9_
private

Definition at line 73 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapLowr9_
private

Definition at line 74 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLC_
private

Definition at line 68 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEB_
private

Definition at line 70 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEE_
private

Definition at line 71 of file PFProducer.h.

const GBRForest* PFProducer::ReaderRes_
private

Definition at line 69 of file PFProducer.h.

bool PFProducer::useCalibrationsFromDB_
private

Definition at line 83 of file PFProducer.h.

bool PFProducer::useEGammaElectrons_
private

Definition at line 77 of file PFProducer.h.

bool PFProducer::useHO_
private

Definition at line 50 of file PFProducer.h.

bool PFProducer::usePFElectrons_
private

Definition at line 59 of file PFProducer.h.

bool PFProducer::usePFPhotons_
private

Definition at line 62 of file PFProducer.h.

bool PFProducer::usePhotonReg_
private

Definition at line 65 of file PFProducer.h.

bool PFProducer::useRegressionFromDB_
private

Definition at line 66 of file PFProducer.h.

bool PFProducer::useVerticesForNeutral_
private

Definition at line 80 of file PFProducer.h.

bool PFProducer::verbose_
private

verbose ?

Definition at line 53 of file PFProducer.h.

edm::InputTag PFProducer::vertices_
private

Definition at line 42 of file PFProducer.h.