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::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
 PFProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~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 &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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(), and LogDebug.

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  // Muon parameters
283  std::vector<double> muonHCAL
284  = iConfig.getParameter<std::vector<double> >("muon_HCAL");
285  std::vector<double> muonECAL
286  = iConfig.getParameter<std::vector<double> >("muon_ECAL");
287  std::vector<double> muonHO
288  = iConfig.getParameter<std::vector<double> >("muon_HO");
289 
290  assert ( muonHCAL.size() == 2 && muonECAL.size() == 2 && muonHO.size() == 2);
291 
292  // Fake track parameters
293  double nSigmaTRACK
294  = iConfig.getParameter<double>("nsigma_TRACK");
295 
296  double ptError
297  = iConfig.getParameter<double>("pt_Error");
298 
299  std::vector<double> factors45
300  = iConfig.getParameter<std::vector<double> >("factors_45");
301  assert ( factors45.size() == 2 );
302 
303  bool usePFMuonMomAssign
304  = iConfig.getParameter<bool>("usePFMuonMomAssign");
305 
306  bool useBestMuonTrack
307  = iConfig.getParameter<bool>("useBestMuonTrack");
308 
309  // Set muon and fake track parameters
310  pfAlgo_->setPFMuonAndFakeParameters(muonHCAL,
311  muonECAL,
312  muonHO,
313  nSigmaTRACK,
314  ptError,
315  factors45,
316  usePFMuonMomAssign,
317  useBestMuonTrack);
318 
319  //Post cleaning of the HF
320  bool postHFCleaning
321  = iConfig.getParameter<bool>("postHFCleaning");
322 
323  double minHFCleaningPt
324  = iConfig.getParameter<double>("minHFCleaningPt");
325  double minSignificance
326  = iConfig.getParameter<double>("minSignificance");
327  double maxSignificance
328  = iConfig.getParameter<double>("maxSignificance");
329  double minSignificanceReduction
330  = iConfig.getParameter<double>("minSignificanceReduction");
331  double maxDeltaPhiPt
332  = iConfig.getParameter<double>("maxDeltaPhiPt");
333  double minDeltaMet
334  = iConfig.getParameter<double>("minDeltaMet");
335 
336  // Set post HF cleaning muon parameters
337  pfAlgo_->setPostHFCleaningParameters(postHFCleaning,
338  minHFCleaningPt,
339  minSignificance,
340  maxSignificance,
341  minSignificanceReduction,
342  maxDeltaPhiPt,
343  minDeltaMet);
344 
345  // Input tags for HF cleaned rechits
347  = iConfig.getParameter< std::vector<edm::InputTag> >("cleanedHF");
348 
349  //MIKE: Vertex Parameters
350  vertices_ = iConfig.getParameter<edm::InputTag>("vertexCollection");
351  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
352 
353  // Use HO clusters and links in the PF reconstruction
354  useHO_= iConfig.getParameter<bool>("useHO");
355  pfAlgo_->setHOTag(useHO_);
356 
357  verbose_ =
358  iConfig.getUntrackedParameter<bool>("verbose",false);
359 
360  bool debug_ =
361  iConfig.getUntrackedParameter<bool>("debug",false);
362 
363  pfAlgo_->setDebug( debug_ );
364 
365 }
#define LogDebug(id)
const GBRForest * ReaderRes_
Definition: PFProducer.h:70
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string photonExtraOutputCol_
Definition: PFProducer.h:48
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:90
edm::InputTag inputTagMuons_
Definition: PFProducer.h:42
const GBRForest * ReaderLC_
Definition: PFProducer.h:69
std::vector< edm::InputTag > inputTagCleanedHF_
Definition: PFProducer.h:45
bool useCalibrationsFromDB_
Definition: PFProducer.h:84
bool useVerticesForNeutral_
Definition: PFProducer.h:81
edm::InputTag vertices_
Definition: PFProducer.h:43
bool postMuonCleaning_
Definition: PFProducer.h:57
bool useHO_
Definition: PFProducer.h:51
bool useRegressionFromDB_
Definition: PFProducer.h:67
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:41
bool usePFElectrons_
Definition: PFProducer.h:60
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:44
std::string electronOutputCol_
Definition: PFProducer.h:46
bool verbose_
verbose ?
Definition: PFProducer.h:54
std::string electronExtraOutputCol_
Definition: PFProducer.h:47
bool useEGammaElectrons_
Definition: PFProducer.h:78
bool usePFPhotons_
Definition: PFProducer.h:63
Definition: PFAlgo.h:48
bool usePhotonReg_
Definition: PFProducer.h:66
const GBRForest * ReaderGC_
Definition: PFProducer.h:68
PFProducer::~PFProducer ( )

Definition at line 369 of file PFProducer.cc.

369 {}

Member Function Documentation

void PFProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 373 of file PFProducer.cc.

373 {}
void PFProducer::beginRun ( edm::Run run,
const edm::EventSetup es 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 376 of file PFProducer.cc.

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

378 {
379 
380 
381  /*
382  static map<string, PerformanceResult::ResultType> functType;
383 
384  functType["PFfa_BARREL"] = PerformanceResult::PFfa_BARREL;
385  functType["PFfa_ENDCAP"] = PerformanceResult::PFfa_ENDCAP;
386  functType["PFfb_BARREL"] = PerformanceResult::PFfb_BARREL;
387  functType["PFfb_ENDCAP"] = PerformanceResult::PFfb_ENDCAP;
388  functType["PFfc_BARREL"] = PerformanceResult::PFfc_BARREL;
389  functType["PFfc_ENDCAP"] = PerformanceResult::PFfc_ENDCAP;
390  functType["PFfaEta_BARREL"] = PerformanceResult::PFfaEta_BARREL;
391  functType["PFfaEta_ENDCAP"] = PerformanceResult::PFfaEta_ENDCAP;
392  functType["PFfbEta_BARREL"] = PerformanceResult::PFfbEta_BARREL;
393  functType["PFfbEta_ENDCAP"] = PerformanceResult::PFfbEta_ENDCAP;
394  */
395 
396  if ( useCalibrationsFromDB_ ) {
397  // Read the PFCalibration functions from the global tags.
399  es.get<PFCalibrationRcd>().get(perfH);
400 
401  const PerformancePayloadFromTFormula *pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());
402 
403  pfAlgo_->thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
404  }
405 
406  /*
407  for(vector<string>::const_iterator name = fToRead.begin(); name != fToRead.end(); ++name) {
408 
409  cout << "Function: " << *name << endl;
410  PerformanceResult::ResultType fType = functType[*name];
411  pfCalibrations->printFormula(fType);
412 
413  // evaluate it @ 10 GeV
414  float energy = 10.;
415 
416  BinningPointByMap point;
417  point.insert(BinningVariables::JetEt, energy);
418 
419  if(pfCalibrations->isInPayload(fType, point)) {
420  float value = pfCalibrations->getResult(fType, point);
421  cout << " Energy before:: " << energy << " after: " << value << endl;
422  } else cout << "outside limits!" << endl;
423 
424  }
425  */
426 
428  edm::ESHandle<GBRForest> readerPFLCEB;
429  edm::ESHandle<GBRForest> readerPFLCEE;
430  edm::ESHandle<GBRForest> readerPFGCEB;
431  edm::ESHandle<GBRForest> readerPFGCEEHR9;
432  edm::ESHandle<GBRForest> readerPFGCEELR9;
433  edm::ESHandle<GBRForest> readerPFRes;
434  es.get<GBRWrapperRcd>().get("PFLCorrectionBar",readerPFLCEB);
435  ReaderLCEB_=readerPFLCEB.product();
436  es.get<GBRWrapperRcd>().get("PFLCorrectionEnd",readerPFLCEE);
437  ReaderLCEE_=readerPFLCEE.product();
438  es.get<GBRWrapperRcd>().get("PFGCorrectionBar",readerPFGCEB);
439  ReaderGCBarrel_=readerPFGCEB.product();
440  es.get<GBRWrapperRcd>().get("PFGCorrectionEndHighR9",readerPFGCEEHR9);
441  ReaderGCEndCapHighr9_=readerPFGCEEHR9.product();
442  es.get<GBRWrapperRcd>().get("PFGCorrectionEndLowR9",readerPFGCEELR9);
443  ReaderGCEndCapLowr9_=readerPFGCEELR9.product();
444  es.get<GBRWrapperRcd>().get("PFEcalResolution",readerPFRes);
445  ReaderEcalRes_=readerPFRes.product();
446 
447  /*
448  LogDebug("PFProducer")<<"setting regressions from DB "<<endl;
449  */
450  }
451 
452  if(usePFPhotons_){
453  //pfAlgo_->setPFPhotonRegWeights(ReaderLC_, ReaderGC_, ReaderRes_);
455  }
456 }
const GBRForest * ReaderEcalRes_
Definition: PFProducer.h:76
const GBRForest * ReaderLCEB_
Definition: PFProducer.h:71
const GBRForest * ReaderGCEndCapHighr9_
Definition: PFProducer.h:74
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:90
bool useCalibrationsFromDB_
Definition: PFProducer.h:84
const GBRForest * ReaderLCEE_
Definition: PFProducer.h:72
const GBRForest * ReaderGCEndCapLowr9_
Definition: PFProducer.h:75
bool useRegressionFromDB_
Definition: PFProducer.h:67
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool usePFPhotons_
Definition: PFProducer.h:63
const GBRForest * ReaderGCBarrel_
Definition: PFProducer.h:73
void PFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 460 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::Event::put(), and edm::EventID::run().

461  {
462 
463  LogDebug("PFProducer")<<"START event: "
464  <<iEvent.id().event()
465  <<" in run "<<iEvent.id().run()<<endl;
466 
467 
468  // Get The vertices from the event
469  // and assign dynamic vertex parameters
471  bool gotVertices = iEvent.getByLabel(vertices_,vertices);
472  if(!gotVertices) {
473  ostringstream err;
474  err<<"Cannot find vertices for this event.Continuing Without them ";
475  LogError("PFProducer")<<err.str()<<endl;
476  }
477 
478  //Assign the PFAlgo Parameters
479  pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,*vertices);
480 
481  // get the collection of blocks
482 
484 
485  LogDebug("PFProducer")<<"getting blocks"<<endl;
486  bool found = iEvent.getByLabel( inputTagBlocks_, blocks );
487 
488  if(!found ) {
489 
490  ostringstream err;
491  err<<"cannot find blocks: "<<inputTagBlocks_;
492  LogError("PFProducer")<<err.str()<<endl;
493 
494  throw cms::Exception( "MissingProduct", err.str());
495  }
496 
497  // get the collection of muons
498 
500 
501  if ( postMuonCleaning_ ) {
502 
503  LogDebug("PFProducer")<<"getting muons"<<endl;
504  found = iEvent.getByLabel( inputTagMuons_, muons );
505 
506  if(!found) {
507  ostringstream err;
508  err<<"cannot find muons: "<<inputTagMuons_;
509  LogError("PFProducer")<<err.str()<<endl;
510 
511  throw cms::Exception( "MissingProduct", err.str());
512  }
513 
514  }
515 
516  if (useEGammaElectrons_) {
518 
519  LogDebug("PFProducer")<<" Reading e/gamma electrons activated "<<endl;
520  found = iEvent.getByLabel( inputTagEgammaElectrons_, egelectrons );
521 
522  if(!found) {
523  ostringstream err;
524  err<<"cannot find electrons: "<<inputTagEgammaElectrons_;
525  LogError("PFProducer")<<err.str()<<endl;
526 
527  throw cms::Exception( "MissingProduct", err.str());
528  }
529 
530  pfAlgo_->setEGElectronCollection(*egelectrons);
531  }
532 
533 
534  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
535 
536  assert( blocks.isValid() );
537 
538  pfAlgo_->reconstructParticles( blocks );
539 
540  if(verbose_) {
541  ostringstream str;
542  str<<(*pfAlgo_)<<endl;
543  // cout << (*pfAlgo_) << endl;
544  LogInfo("PFProducer") <<str.str()<<endl;
545  }
546 
547 
548  if ( postMuonCleaning_ )
549  pfAlgo_->postMuonCleaning( muons, *vertices );
550 
551  // Florian 5/01/2011
552  // Save the PFElectron Extra Collection First as to be able to create valid References
553  if(usePFElectrons_) {
554  auto_ptr< reco::PFCandidateElectronExtraCollection >
555  pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
556 
558  iEvent.put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
559  pfAlgo_->setElectronExtraRef(electronExtraProd);
560  }
561 
562  // Daniele 18/05/2011
563  // Save the PFPhoton Extra Collection First as to be able to create valid References
564  if(usePFPhotons_) {
565  auto_ptr< reco::PFCandidatePhotonExtraCollection >
566  pOutputPhotonCandidateExtraCollection( pfAlgo_->transferPhotonExtra() );
567 
569  iEvent.put(pOutputPhotonCandidateExtraCollection,photonExtraOutputCol_);
570  pfAlgo_->setPhotonExtraRef(photonExtraProd);
571  }
572 
573 
574  // Save cosmic cleaned muon candidates
575  auto_ptr< reco::PFCandidateCollection >
576  pCosmicsMuonCleanedCandidateCollection( pfAlgo_->transferCosmicsMuonCleanedCandidates() );
577  // Save tracker/global cleaned muon candidates
578  auto_ptr< reco::PFCandidateCollection >
579  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->transferCleanedTrackerAndGlobalMuonCandidates() );
580  // Save fake cleaned muon candidates
581  auto_ptr< reco::PFCandidateCollection >
582  pFakeCleanedMuonCandidateCollection( pfAlgo_->transferFakeMuonCleanedCandidates() );
583  // Save punch-through cleaned muon candidates
584  auto_ptr< reco::PFCandidateCollection >
585  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->transferPunchThroughMuonCleanedCandidates() );
586  // Save punch-through cleaned neutral hadron candidates
587  auto_ptr< reco::PFCandidateCollection >
588  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->transferPunchThroughHadronCleanedCandidates() );
589  // Save added muon candidates
590  auto_ptr< reco::PFCandidateCollection >
591  pAddedMuonCandidateCollection( pfAlgo_->transferAddedMuonCandidates() );
592 
593  // Check HF overcleaning
595  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
597  bool foundHF = iEvent.getByLabel( inputTagCleanedHF_[ihf], hfCleaned );
598  if (!foundHF) continue;
599  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
600  hfCopy.push_back( (*hfCleaned)[jhf] );
601  }
602  }
603  pfAlgo_->checkCleaning( hfCopy );
604 
605  // Save recovered HF candidates
606  auto_ptr< reco::PFCandidateCollection >
607  pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
608 
609 
610  // Save the final PFCandidate collection
611  auto_ptr< reco::PFCandidateCollection >
612  pOutputCandidateCollection( pfAlgo_->transferCandidates() );
613 
614 
615 
616  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
617  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
618  int nC=0;
619  for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
620  nC++;
621  if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl;
622 
623  }
624 
625  // Write in the event
626  iEvent.put(pOutputCandidateCollection);
627  iEvent.put(pCleanedCandidateCollection,"CleanedHF");
628 
629  if ( postMuonCleaning_ ) {
630  iEvent.put(pCosmicsMuonCleanedCandidateCollection,"CleanedCosmicsMuons");
631  iEvent.put(pTrackerAndGlobalCleanedMuonCandidateCollection,"CleanedTrackerAndGlobalMuons");
632  iEvent.put(pFakeCleanedMuonCandidateCollection,"CleanedFakeMuons");
633  iEvent.put(pPunchThroughMuonCleanedCandidateCollection,"CleanedPunchThroughMuons");
634  iEvent.put(pPunchThroughHadronCleanedCandidateCollection,"CleanedPunchThroughNeutralHadrons");
635  iEvent.put(pAddedMuonCandidateCollection,"AddedMuonsAndHadrons");
636  }
637 
638  if(usePFElectrons_)
639  {
640  auto_ptr< reco::PFCandidateCollection >
641  pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
642  iEvent.put(pOutputElectronCandidateCollection,electronOutputCol_);
643 
644  }
645 }
#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:48
int ihf
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:90
edm::InputTag inputTagMuons_
Definition: PFProducer.h:42
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
std::vector< edm::InputTag > inputTagCleanedHF_
Definition: PFProducer.h:45
bool useVerticesForNeutral_
Definition: PFProducer.h:81
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
edm::InputTag vertices_
Definition: PFProducer.h:43
bool postMuonCleaning_
Definition: PFProducer.h:57
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:41
bool usePFElectrons_
Definition: PFProducer.h:60
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:44
std::string electronOutputCol_
Definition: PFProducer.h:46
bool verbose_
verbose ?
Definition: PFProducer.h:54
list blocks
Definition: gather_cfg.py:90
std::string electronExtraOutputCol_
Definition: PFProducer.h:47
bool useEGammaElectrons_
Definition: PFProducer.h:78
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:63

Member Data Documentation

std::string PFProducer::electronExtraOutputCol_
private

Definition at line 47 of file PFProducer.h.

std::string PFProducer::electronOutputCol_
private

Definition at line 46 of file PFProducer.h.

edm::InputTag PFProducer::inputTagBlocks_
private

Definition at line 41 of file PFProducer.h.

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

Definition at line 45 of file PFProducer.h.

edm::InputTag PFProducer::inputTagEgammaElectrons_
private

Definition at line 44 of file PFProducer.h.

edm::InputTag PFProducer::inputTagMuons_
private

Definition at line 42 of file PFProducer.h.

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

particle flow algorithm

Definition at line 90 of file PFProducer.h.

std::string PFProducer::photonExtraOutputCol_
private

Definition at line 48 of file PFProducer.h.

bool PFProducer::postMuonCleaning_
private

Definition at line 57 of file PFProducer.h.

const GBRForest* PFProducer::ReaderEcalRes_
private

Definition at line 76 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGC_
private

Definition at line 68 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCBarrel_
private

Definition at line 73 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapHighr9_
private

Definition at line 74 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapLowr9_
private

Definition at line 75 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLC_
private

Definition at line 69 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEB_
private

Definition at line 71 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEE_
private

Definition at line 72 of file PFProducer.h.

const GBRForest* PFProducer::ReaderRes_
private

Definition at line 70 of file PFProducer.h.

bool PFProducer::useCalibrationsFromDB_
private

Definition at line 84 of file PFProducer.h.

bool PFProducer::useEGammaElectrons_
private

Definition at line 78 of file PFProducer.h.

bool PFProducer::useHO_
private

Definition at line 51 of file PFProducer.h.

bool PFProducer::usePFElectrons_
private

Definition at line 60 of file PFProducer.h.

bool PFProducer::usePFPhotons_
private

Definition at line 63 of file PFProducer.h.

bool PFProducer::usePhotonReg_
private

Definition at line 66 of file PFProducer.h.

bool PFProducer::useRegressionFromDB_
private

Definition at line 67 of file PFProducer.h.

bool PFProducer::useVerticesForNeutral_
private

Definition at line 81 of file PFProducer.h.

bool PFProducer::verbose_
private

verbose ?

Definition at line 54 of file PFProducer.h.

edm::InputTag PFProducer::vertices_
private

Definition at line 43 of file PFProducer.h.