CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FSPFProducer.cc
Go to the documentation of this file.
4 
8 
9 using namespace std;
10 using namespace edm;
11 using namespace reco;
12 
13 
15 
16  labelPFCandidateCollection_ = iConfig.getParameter < edm::InputTag > ("pfCandidates");
17 
18  par1 = iConfig.getParameter<double>("par1");
19  par2 = iConfig.getParameter<double>("par2");
20  barrel_th = iConfig.getParameter<double>("barrel_th");
21  endcap_th = iConfig.getParameter<double>("endcap_th");
22  middle_th = iConfig.getParameter<double>("middle_th");
23  // register products
24  produces<reco::PFCandidateCollection>();
25 
26 }
27 
29 
30 void
32 
33 void
35  const edm::EventSetup & iSetup) {}
36 
37 void
39  const EventSetup& iSetup) {
40 
42  iEvent.getByLabel (labelPFCandidateCollection_, pfCandidates);
43 
44  auto_ptr< reco::PFCandidateCollection > pOutputCandidateCollection(new PFCandidateCollection);
45 
46  LogDebug("FSPFProducer")<<"START event: "
47  <<iEvent.id().event()
48  <<" in run "<<iEvent.id().run()<<endl;
49 
50  double theNeutralFraction, px, py, pz, en;
51  reco::PFCandidateCollection::const_iterator itCand = pfCandidates->begin();
52  reco::PFCandidateCollection::const_iterator itCandEnd = pfCandidates->end();
53  for( ; itCand != itCandEnd; itCand++) {
54  pOutputCandidateCollection->push_back(*itCand);
55  if(itCand->particleId() == reco::PFCandidate::h){
56  theNeutralFraction = par1 - par2*itCand->energy();
57  if(theNeutralFraction > 0.){
58  px = theNeutralFraction*itCand->px();
59  py = theNeutralFraction*itCand->py();
60  pz = theNeutralFraction*itCand->pz();
61  en = sqrt(px*px + py*py + pz*pz);
62  if (en > energy_threshold(itCand->eta())) {
63  // create a PFCandidate and add it to the particles Collection
64  math::XYZTLorentzVector momentum(px,py,pz,en);
65  reco::PFCandidate FakeNeutralHadron(0, momentum, reco::PFCandidate::h0);
66  pOutputCandidateCollection->push_back(FakeNeutralHadron);
67  }
68  }
69  }
70  }
71  iEvent.put(pOutputCandidateCollection);
72 }
73 
75  if (eta<0) eta = -eta;
76  if (eta < 1.6) return barrel_th;
77  else if (eta < 1.8) return middle_th;
78  else return endcap_th;
79 }
80 
81 
82 
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: FSPFProducer.cc:38
T eta() const
virtual void beginRun(edm::Run &, const edm::EventSetup &)
Definition: FSPFProducer.cc:34
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
T sqrt(T t)
Definition: SSEVec.h:46
FSPFProducer(const edm::ParameterSet &)
Definition: FSPFProducer.cc:14
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EventID id() const
Definition: EventBase.h:56
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
double energy_threshold(double eta)
Definition: FSPFProducer.cc:74
virtual void beginJob()
Definition: FSPFProducer.cc:31
Definition: Run.h:33