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...
 
bool postMuonCleaning_
 
bool useEGammaElectrons_
 
bool usePFElectrons_
 
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)
 
- 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 29 of file PFProducer.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file PFProducer.cc.

References ExpressReco_HICollisions_FallBack::algoType, ExpressReco_HICollisions_FallBack::calibHF_a_EMHAD, ExpressReco_HICollisions_FallBack::calibHF_a_EMonly, ExpressReco_HICollisions_FallBack::calibHF_b_EMHAD, ExpressReco_HICollisions_FallBack::calibHF_b_HADonly, ExpressReco_HICollisions_FallBack::calibHF_eta_step, ExpressReco_HICollisions_FallBack::calibHF_use, ExpressReco_HICollisions_FallBack::calibPFSCEle_barrel, ExpressReco_HICollisions_FallBack::calibPFSCEle_endcap, ExpressReco_HICollisions_FallBack::coneEcalIsoForEgammaSC, ExpressReco_HICollisions_FallBack::coneTrackIsoForEgammaSC, ExpressReco_HICollisions_FallBack::dptRel_DispVtx, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, ExpressReco_HICollisions_FallBack::iCfgCandConnector, ExpressReco_HICollisions_FallBack::maxDeltaPhiPt, ExpressReco_HICollisions_FallBack::maxSignificance, ExpressReco_HICollisions_FallBack::minDeltaMet, ExpressReco_HICollisions_FallBack::minHFCleaningPt, ExpressReco_HICollisions_FallBack::minSignificance, ExpressReco_HICollisions_FallBack::minSignificanceReduction, h::names, ExpressReco_HICollisions_FallBack::nTrackIsoForEgammaSC, ExpressReco_HICollisions_FallBack::postHFCleaning, ExpressReco_HICollisions_FallBack::rejectTracks_Bad, ExpressReco_HICollisions_FallBack::rejectTracks_Step45, ExpressReco_HICollisions_FallBack::sumEtEcalIsoForEgammaSC_barrel, ExpressReco_HICollisions_FallBack::sumEtEcalIsoForEgammaSC_endcap, ExpressReco_HICollisions_FallBack::sumPtTrackIsoForEgammaSC_barrel, ExpressReco_HICollisions_FallBack::sumPtTrackIsoForEgammaSC_endcap, ExpressReco_HICollisions_FallBack::useEGammaSupercluster, ExpressReco_HICollisions_FallBack::usePFConversions, ExpressReco_HICollisions_FallBack::usePFDecays, ExpressReco_HICollisions_FallBack::usePFMuonMomAssign, ExpressReco_HICollisions_FallBack::usePFNuclearInteractions, and ExpressReco_HICollisions_FallBack::usePFSCEleCalib.

22  {
23 
24  unsigned int newCalib =
25  iConfig.getParameter<unsigned int>("pf_newCalib");
26 
27  // Create a PFClusterCalbration auto_ptr
28  boost::shared_ptr<pftools::PFClusterCalibration>
29  clusterCalibration( new pftools::PFClusterCalibration() );
30 
31  // Initialise function parameters properly.
32  double lowEP0
33  = iConfig.getParameter<double>("pfcluster_lowEP0");
34  double lowEP1
35  = iConfig.getParameter<double>("pfcluster_lowEP1");
36  double globalP0
37  = iConfig.getParameter<double>("pfcluster_globalP0");
38  double globalP1
39  = iConfig.getParameter<double>("pfcluster_globalP1");
40  //
41  clusterCalibration->setCorrections(lowEP0, lowEP1, globalP0, globalP1);
42 
43  unsigned int allowNegative
44  = iConfig.getParameter<unsigned int>("pfcluster_allowNegative");
45  clusterCalibration->setAllowNegativeEnergy(allowNegative);
46 
47  unsigned int doCorrection
48  = iConfig.getParameter<unsigned int>("pfcluster_doCorrection");
49  clusterCalibration->setDoCorrection(doCorrection);
50 
51  double barrelEta
52  = iConfig.getParameter<double>("pfcluster_barrelEndcapEtaDiv");
53  clusterCalibration->setBarrelBoundary(barrelEta);
54 
55  /* Now obsolete
56  double ecalEcut =
57  iConfig.getParameter<double>("pfcluster_ecalECut");
58  double hcalEcut =
59  iConfig.getParameter<double>("pfcluster_hcalECut");
60 
61  clusterCalibration->setEcalHcalEnergyCuts(ecalEcut,hcalEcut);
62  */
63 
64  std::vector<std::string>* names = clusterCalibration->getKnownSectorNames();
65  for(std::vector<std::string>::iterator i = names->begin(); i != names->end(); ++i) {
66  std::string sector = *i;
67  std::vector<double> params
68  = iConfig.getParameter<std::vector<double> >(sector);
69  clusterCalibration->setEvolutionParameters(sector, params);
70  }
71 
72  //Finally set eta correction
73  unsigned int doEtaCorrection = iConfig.getParameter<unsigned int>("pfcluster_doEtaCorrection");
74  clusterCalibration->setDoEtaCorrection(doEtaCorrection);
75 
76  std::vector<double> etaCorrectionParams =
77  iConfig.getParameter<std::vector<double> >("pfcluster_etaCorrection");
78  clusterCalibration->setEtaCorrectionParameters(etaCorrectionParams);
79  // use configuration file to setup input/output collection names
80  //std::cout << "Finished initialisaing PFClusterCalibration: it looks like...\n";
81  //std::cout << *clusterCalibration << std::endl;
82 
83  //Done with PFClusterCalibration //
84 
85  //--ab: get calibration factors for HF:
86  bool calibHF_use;
87  std::vector<double> calibHF_eta_step;
88  std::vector<double> calibHF_a_EMonly;
89  std::vector<double> calibHF_b_HADonly;
90  std::vector<double> calibHF_a_EMHAD;
91  std::vector<double> calibHF_b_EMHAD;
92  calibHF_use = iConfig.getParameter<bool>("calibHF_use");
93  calibHF_eta_step = iConfig.getParameter<std::vector<double> >("calibHF_eta_step");
94  calibHF_a_EMonly = iConfig.getParameter<std::vector<double> >("calibHF_a_EMonly");
95  calibHF_b_HADonly = iConfig.getParameter<std::vector<double> >("calibHF_b_HADonly");
96  calibHF_a_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_a_EMHAD");
97  calibHF_b_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_b_EMHAD");
98  boost::shared_ptr<PFEnergyCalibrationHF>
99  thepfEnergyCalibrationHF ( new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
100  //-----------------
101 
103  = iConfig.getParameter<InputTag>("blocks");
104 
105  //Post cleaning of the muons
107  = iConfig.getParameter<InputTag>("muons");
109  = iConfig.getParameter<bool>("postMuonCleaning");
110 
112  = iConfig.getParameter<bool>("usePFElectrons");
113 
115  = iConfig.getParameter<bool>("useEGammaElectrons");
116 
117  if( useEGammaElectrons_) {
118  inputTagEgammaElectrons_ = iConfig.getParameter<edm::InputTag>("egammaElectrons");
119  }
120 
122  = iConfig.getParameter<std::string>("pf_electron_output_col");
123 
124  bool usePFSCEleCalib;
125  std::vector<double> calibPFSCEle_barrel;
126  std::vector<double> calibPFSCEle_endcap;
127  usePFSCEleCalib = iConfig.getParameter<bool>("usePFSCEleCalib");
128  calibPFSCEle_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_barrel");
129  calibPFSCEle_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_endcap");
130  boost::shared_ptr<PFSCEnergyCalibration>
131  thePFSCEnergyCalibration ( new PFSCEnergyCalibration(calibPFSCEle_barrel,calibPFSCEle_endcap ));
132 
133  bool useEGammaSupercluster = iConfig.getParameter<bool>("useEGammaSupercluster");
134  double sumEtEcalIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_barrel");
135  double sumEtEcalIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_endcap");
136  double coneEcalIsoForEgammaSC = iConfig.getParameter<double>("coneEcalIsoForEgammaSC");
137  double sumPtTrackIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_barrel");
138  double sumPtTrackIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_endcap");
139  double coneTrackIsoForEgammaSC = iConfig.getParameter<double>("coneTrackIsoForEgammaSC");
140  unsigned int nTrackIsoForEgammaSC = iConfig.getParameter<unsigned int>("nTrackIsoForEgammaSC");
141 
142 
143  // register products
144  produces<reco::PFCandidateCollection>();
145  produces<reco::PFCandidateCollection>("CleanedHF");
146  produces<reco::PFCandidateCollection>("CleanedCosmicsMuons");
147  produces<reco::PFCandidateCollection>("CleanedTrackerAndGlobalMuons");
148  produces<reco::PFCandidateCollection>("CleanedFakeMuons");
149  produces<reco::PFCandidateCollection>("CleanedPunchThroughMuons");
150  produces<reco::PFCandidateCollection>("CleanedPunchThroughNeutralHadrons");
151  produces<reco::PFCandidateCollection>("AddedMuonsAndHadrons");
152 
153 
154  if (usePFElectrons_) {
155  produces<reco::PFCandidateCollection>(electronOutputCol_);
156  produces<reco::PFCandidateElectronExtraCollection>(electronExtraOutputCol_);
157  }
158 
159  double nSigmaECAL
160  = iConfig.getParameter<double>("pf_nsigma_ECAL");
161  double nSigmaHCAL
162  = iConfig.getParameter<double>("pf_nsigma_HCAL");
163 
164 
165  double e_slope
166  = iConfig.getParameter<double>("pf_calib_ECAL_slope");
167  double e_offset
168  = iConfig.getParameter<double>("pf_calib_ECAL_offset");
169 
170  double eh_eslope
171  = iConfig.getParameter<double>("pf_calib_ECAL_HCAL_eslope");
172  double eh_hslope
173  = iConfig.getParameter<double>("pf_calib_ECAL_HCAL_hslope");
174  double eh_offset
175  = iConfig.getParameter<double>("pf_calib_ECAL_HCAL_offset");
176 
177  double h_slope
178  = iConfig.getParameter<double>("pf_calib_HCAL_slope");
179  double h_offset
180  = iConfig.getParameter<double>("pf_calib_HCAL_offset");
181  double h_damping
182  = iConfig.getParameter<double>("pf_calib_HCAL_damping");
183 
184  //PFElectrons Configuration
185  double mvaEleCut
186  = iConfig.getParameter<double>("pf_electron_mvaCut");
187 
188  string mvaWeightFileEleID
189  = iConfig.getParameter<string>("pf_electronID_mvaWeightFile");
190 
191  bool applyCrackCorrectionsForElectrons
192  = iConfig.getParameter<bool>("pf_electronID_crackCorrection");
193 
194  string path_mvaWeightFileEleID;
195  if(usePFElectrons_)
196  {
197  path_mvaWeightFileEleID = edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
198  }
199 
200 
201  //Secondary tracks and displaced vertices parameters
202 
203  bool rejectTracks_Bad
204  = iConfig.getParameter<bool>("rejectTracks_Bad");
205 
207  = iConfig.getParameter<bool>("rejectTracks_Step45");
208 
210  = iConfig.getParameter<bool>("usePFNuclearInteractions");
211 
212  bool usePFConversions
213  = iConfig.getParameter<bool>("usePFConversions");
214 
215  bool usePFDecays
216  = iConfig.getParameter<bool>("usePFDecays");
217 
218  double dptRel_DispVtx
219  = iConfig.getParameter<double>("dptRel_DispVtx");
220 
222  = iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector");
223 
224 
225  boost::shared_ptr<PFEnergyCalibration>
226  calibration( new PFEnergyCalibration( e_slope,
227  e_offset,
228  eh_eslope,
229  eh_hslope,
230  eh_offset,
231  h_slope,
232  h_offset,
233  h_damping,
234  newCalib ) );
235 
236  int algoType
237  = iConfig.getParameter<unsigned>("algoType");
238 
239  switch(algoType) {
240  case 0:
241  pfAlgo_.reset( new PFAlgo);
242  break;
243  default:
244  assert(0);
245  }
246 
247  pfAlgo_->setParameters( nSigmaECAL,
248  nSigmaHCAL,
249  calibration,
250  clusterCalibration,
251  thepfEnergyCalibrationHF,
252  newCalib);
253 
254  //PFElectrons: call the method setpfeleparameters
255  pfAlgo_->setPFEleParameters(mvaEleCut,
256  path_mvaWeightFileEleID,
257  usePFElectrons_,
258  thePFSCEnergyCalibration,
259  sumEtEcalIsoForEgammaSC_barrel,
260  sumEtEcalIsoForEgammaSC_endcap,
261  coneEcalIsoForEgammaSC,
262  sumPtTrackIsoForEgammaSC_barrel,
263  sumPtTrackIsoForEgammaSC_endcap,
264  nTrackIsoForEgammaSC,
265  coneTrackIsoForEgammaSC,
266  applyCrackCorrectionsForElectrons,
267  usePFSCEleCalib,
268  useEGammaElectrons_,
269  useEGammaSupercluster);
270 
271  // pfAlgo_->setPFConversionParameters(usePFConversions);
272 
273  //Secondary tracks and displaced vertices parameters
274 
275  pfAlgo_->setDisplacedVerticesParameters(rejectTracks_Bad,
276  rejectTracks_Step45,
277  usePFNuclearInteractions,
278  usePFConversions,
279  usePFDecays,
280  dptRel_DispVtx);
281 
282 
283 
284 
285 
286  if (usePFNuclearInteractions)
287  pfAlgo_->setCandConnectorParameters( iCfgCandConnector );
288 
289  // Muon parameters
290  std::vector<double> muonHCAL
291  = iConfig.getParameter<std::vector<double> >("muon_HCAL");
292  std::vector<double> muonECAL
293  = iConfig.getParameter<std::vector<double> >("muon_ECAL");
294  assert ( muonHCAL.size() == 2 && muonECAL.size() == 2 );
295 
296  // Fake track parameters
297  double nSigmaTRACK
298  = iConfig.getParameter<double>("nsigma_TRACK");
299 
300  double ptError
301  = iConfig.getParameter<double>("pt_Error");
302 
303  std::vector<double> factors45
304  = iConfig.getParameter<std::vector<double> >("factors_45");
305  assert ( factors45.size() == 2 );
306 
307  bool usePFMuonMomAssign
308  = iConfig.getParameter<bool>("usePFMuonMomAssign");
309 
310  // Set muon and fake track parameters
311  pfAlgo_->setPFMuonAndFakeParameters(muonHCAL,
312  muonECAL,
313  nSigmaTRACK,
314  ptError,
315  factors45,
316  usePFMuonMomAssign);
317 
318  //Post cleaning of the HF
319  bool postHFCleaning
320  = iConfig.getParameter<bool>("postHFCleaning");
321 
322  double minHFCleaningPt
323  = iConfig.getParameter<double>("minHFCleaningPt");
324  double minSignificance
325  = iConfig.getParameter<double>("minSignificance");
326  double maxSignificance
327  = iConfig.getParameter<double>("maxSignificance");
329  = iConfig.getParameter<double>("minSignificanceReduction");
330  double maxDeltaPhiPt
331  = iConfig.getParameter<double>("maxDeltaPhiPt");
332  double minDeltaMet
333  = iConfig.getParameter<double>("minDeltaMet");
334 
335  // Set post HF cleaning muon parameters
336  pfAlgo_->setPostHFCleaningParameters(postHFCleaning,
337  minHFCleaningPt,
338  minSignificance,
339  maxSignificance,
340  minSignificanceReduction,
341  maxDeltaPhiPt,
342  minDeltaMet);
343 
344  // Input tags for HF cleaned rechits
346  = iConfig.getParameter< std::vector<edm::InputTag> >("cleanedHF");
347 
348  //MIKE: Vertex Parameters
349  vertices_ = iConfig.getParameter<edm::InputTag>("vertexCollection");
350  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
351 
352 
353 
354  verbose_ =
355  iConfig.getUntrackedParameter<bool>("verbose",false);
356 
357  bool debug_ =
358  iConfig.getUntrackedParameter<bool>("debug",false);
359 
360  pfAlgo_->setDebug( debug_ );
361 
362 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:65
edm::InputTag inputTagMuons_
Definition: PFProducer.h:41
std::vector< edm::InputTag > inputTagCleanedHF_
Definition: PFProducer.h:44
bool useVerticesForNeutral_
Definition: PFProducer.h:61
edm::InputTag vertices_
Definition: PFProducer.h:42
bool postMuonCleaning_
Definition: PFProducer.h:52
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:40
bool usePFElectrons_
Definition: PFProducer.h:55
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:43
std::string electronOutputCol_
Definition: PFProducer.h:45
bool verbose_
verbose ?
Definition: PFProducer.h:49
std::string electronExtraOutputCol_
Definition: PFProducer.h:46
bool useEGammaElectrons_
Definition: PFProducer.h:58
Definition: PFAlgo.h:49
static const HistoName names[]
PFProducer::~PFProducer ( )

Definition at line 366 of file PFProducer.cc.

366 {}

Member Function Documentation

void PFProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 370 of file PFProducer.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 373 of file PFProducer.cc.

374  {}
void PFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 378 of file PFProducer.cc.

References ExpressReco_HICollisions_FallBack::blocks, gather_cfg::cout, edm::EventID::event(), edm::hlt::Exception, newFWLiteAna::found, edm::Event::getByLabel(), edm::EventBase::id(), edm::HandleBase::isValid(), LogDebug, ExpressReco_HICollisions_FallBack::muons, edm::Event::put(), edm::EventID::run(), and ExpressReco_HICollisions_FallBack::vertices.

379  {
380 
381  LogDebug("PFProducer")<<"START event: "
382  <<iEvent.id().event()
383  <<" in run "<<iEvent.id().run()<<endl;
384 
385 
386  // Get The vertices from the event
387  // and assign dynamic vertex parameters
389  bool gotVertices = iEvent.getByLabel(vertices_,vertices);
390  if(!gotVertices) {
391  ostringstream err;
392  err<<"Cannot find vertices for this event.Continuing Without them ";
393  LogError("PFProducer")<<err.str()<<endl;
394  }
395 
396  //Assign the PFAlgo Parameters
397  pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,*vertices);
398 
399  // get the collection of blocks
400 
402 
403  LogDebug("PFProducer")<<"getting blocks"<<endl;
404  bool found = iEvent.getByLabel( inputTagBlocks_, blocks );
405 
406  if(!found ) {
407 
408  ostringstream err;
409  err<<"cannot find blocks: "<<inputTagBlocks_;
410  LogError("PFProducer")<<err.str()<<endl;
411 
412  throw cms::Exception( "MissingProduct", err.str());
413  }
414 
415  // get the collection of muons
416 
418 
419  if ( postMuonCleaning_ ) {
420 
421  LogDebug("PFProducer")<<"getting muons"<<endl;
422  found = iEvent.getByLabel( inputTagMuons_, muons );
423 
424  if(!found) {
425  ostringstream err;
426  err<<"cannot find muons: "<<inputTagMuons_;
427  LogError("PFProducer")<<err.str()<<endl;
428 
429  throw cms::Exception( "MissingProduct", err.str());
430  }
431 
432  }
433 
434  if (useEGammaElectrons_) {
436 
437  LogDebug("PFProducer")<<" Reading e/gamma electrons activated "<<endl;
438  found = iEvent.getByLabel( inputTagEgammaElectrons_, egelectrons );
439 
440  if(!found) {
441  ostringstream err;
442  err<<"cannot find electrons: "<<inputTagEgammaElectrons_;
443  LogError("PFProducer")<<err.str()<<endl;
444 
445  throw cms::Exception( "MissingProduct", err.str());
446  }
447 
448  pfAlgo_->setEGElectronCollection(*egelectrons);
449  }
450 
451 
452  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
453 
454  assert( blocks.isValid() );
455 
456  pfAlgo_->reconstructParticles( blocks );
457 
458  if(verbose_) {
459  ostringstream str;
460  str<<(*pfAlgo_)<<endl;
461  // cout << (*pfAlgo_) << endl;
462  LogInfo("PFProducer") <<str.str()<<endl;
463  }
464 
465 
466  if ( postMuonCleaning_ )
467  pfAlgo_->postMuonCleaning( muons, *vertices );
468 
469  // Florian 5/01/2011
470  // Save the PFElectron Extra Collection First as to be able to create valid References
471  if(usePFElectrons_) {
472  auto_ptr< reco::PFCandidateElectronExtraCollection >
473  pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
474 
476  iEvent.put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
477  pfAlgo_->setElectronExtraRef(electronExtraProd);
478  }
479 
480 
481  // Save cosmic cleaned muon candidates
482  auto_ptr< reco::PFCandidateCollection >
483  pCosmicsMuonCleanedCandidateCollection( pfAlgo_->transferCosmicsMuonCleanedCandidates() );
484  // Save tracker/global cleaned muon candidates
485  auto_ptr< reco::PFCandidateCollection >
486  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->transferCleanedTrackerAndGlobalMuonCandidates() );
487  // Save fake cleaned muon candidates
488  auto_ptr< reco::PFCandidateCollection >
489  pFakeCleanedMuonCandidateCollection( pfAlgo_->transferFakeMuonCleanedCandidates() );
490  // Save punch-through cleaned muon candidates
491  auto_ptr< reco::PFCandidateCollection >
492  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->transferPunchThroughMuonCleanedCandidates() );
493  // Save punch-through cleaned neutral hadron candidates
494  auto_ptr< reco::PFCandidateCollection >
495  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->transferPunchThroughHadronCleanedCandidates() );
496  // Save added muon candidates
497  auto_ptr< reco::PFCandidateCollection >
498  pAddedMuonCandidateCollection( pfAlgo_->transferAddedMuonCandidates() );
499 
500  // Check HF overcleaning
502  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
504  bool foundHF = iEvent.getByLabel( inputTagCleanedHF_[ihf], hfCleaned );
505  if (!foundHF) continue;
506  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
507  hfCopy.push_back( (*hfCleaned)[jhf] );
508  }
509  }
510  pfAlgo_->checkCleaning( hfCopy );
511 
512  // Save recovered HF candidates
513  auto_ptr< reco::PFCandidateCollection >
514  pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
515 
516 
517  // Save the final PFCandidate collection
518  auto_ptr< reco::PFCandidateCollection >
519  pOutputCandidateCollection( pfAlgo_->transferCandidates() );
520 
521 
522 
523  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
524  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
525  int nC=0;
526  for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
527  nC++;
528  if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl;
529 
530  }
531 
532  // Write in the event
533  iEvent.put(pOutputCandidateCollection);
534  iEvent.put(pCleanedCandidateCollection,"CleanedHF");
535 
536  if ( postMuonCleaning_ ) {
537  iEvent.put(pCosmicsMuonCleanedCandidateCollection,"CleanedCosmicsMuons");
538  iEvent.put(pTrackerAndGlobalCleanedMuonCandidateCollection,"CleanedTrackerAndGlobalMuons");
539  iEvent.put(pFakeCleanedMuonCandidateCollection,"CleanedFakeMuons");
540  iEvent.put(pPunchThroughMuonCleanedCandidateCollection,"CleanedPunchThroughMuons");
541  iEvent.put(pPunchThroughHadronCleanedCandidateCollection,"CleanedPunchThroughNeutralHadrons");
542  iEvent.put(pAddedMuonCandidateCollection,"AddedMuonsAndHadrons");
543  }
544 
545  if(usePFElectrons_)
546  {
547  auto_ptr< reco::PFCandidateCollection >
548  pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
549  iEvent.put(pOutputElectronCandidateCollection,electronOutputCol_);
550 
551  }
552 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:65
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:61
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
edm::InputTag vertices_
Definition: PFProducer.h:42
bool postMuonCleaning_
Definition: PFProducer.h:52
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:40
bool usePFElectrons_
Definition: PFProducer.h:55
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:43
std::string electronOutputCol_
Definition: PFProducer.h:45
bool verbose_
verbose ?
Definition: PFProducer.h:49
std::string electronExtraOutputCol_
Definition: PFProducer.h:46
bool useEGammaElectrons_
Definition: PFProducer.h:58
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:41

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 65 of file PFProducer.h.

bool PFProducer::postMuonCleaning_
private

Definition at line 52 of file PFProducer.h.

bool PFProducer::useEGammaElectrons_
private

Definition at line 58 of file PFProducer.h.

bool PFProducer::usePFElectrons_
private

Definition at line 55 of file PFProducer.h.

bool PFProducer::useVerticesForNeutral_
private

Definition at line 61 of file PFProducer.h.

bool PFProducer::verbose_
private

verbose ?

Definition at line 49 of file PFProducer.h.

edm::InputTag PFProducer::vertices_
private

Definition at line 42 of file PFProducer.h.