CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowerCandidateCreator.cc
Go to the documentation of this file.
1 // makes CaloTowerCandidates from CaloTowers
2 // original author: L.Lista INFN
3 // modifyed by: F.Ratnikov UMd
4 // $Id: CaloTowerCandidateCreator.cc,v 1.9 2007/03/07 19:54:50 mansj Exp $
5 #include <cmath>
12 using namespace edm;
13 using namespace reco;
14 using namespace std;
15 
17  :
18  mVerbose (p.getUntrackedParameter<int> ("verbose", 0)),
19  mSource (p.getParameter<edm::InputTag> ("src")),
20  mEtThreshold (p.getParameter<double> ("minimumEt")),
21  mEThreshold (p.getParameter<double> ("minimumE"))
22 {
23  produces<CandidateCollection>();
24 }
25 
27 }
28 
31  evt.getByLabel( mSource, caloTowers );
32 
33  auto_ptr<CandidateCollection> cands( new CandidateCollection );
34  cands->reserve( caloTowers->size() );
35  unsigned idx = 0;
36  for (; idx < caloTowers->size (); idx++) {
37  const CaloTower* cal = &((*caloTowers) [idx]);
38  if (mVerbose >= 2) {
39  std::cout << "CaloTowerCandidateCreator::produce-> " << idx << " tower et/eta/phi/e: "
40  << cal->et() << '/' << cal->eta() << '/' << cal->phi() << '/' << cal->energy() << " is...";
41  }
42  if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold ) {
43  math::PtEtaPhiMLorentzVector p( cal->et(), cal->eta(), cal->phi(), 0 );
46  c->setCaloTower (CaloTowerRef( caloTowers, idx) );
47  cands->push_back( c );
48  if (mVerbose >= 2) std::cout << "accepted: pT/eta/phi:" << c->pt() << '/' << c->eta() << '/' << c->phi() <<std::endl;
49  }
50  else {
51  if (mVerbose >= 2) std::cout << "rejected" << std::endl;
52  }
53  }
54  if (mVerbose >= 1) {
55  std::cout << "CaloTowerCandidateCreator::produce-> " << cands->size () << " candidates created" << std::endl;
56  }
57  evt.put( cands );
58 }
CaloTowerCandidateCreator(const edm::ParameterSet &)
constructor from parameter set
virtual double eta() const
momentum pseudorapidity
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:26
virtual double energy() const
energy
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
edm::InputTag mSource
label of source collection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:39
void produce(edm::Event &e, const edm::EventSetup &)
process one event
tuple cout
Definition: gather_cfg.py:41
double et(double vtxZ) const
Definition: CaloTower.h:101
edm::Ref< CaloTowerCollection > CaloTowerRef
Definition: CaloTowerFwd.h:16
virtual double phi() const
momentum azimuthal angle