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.10 2008/03/04 04:47:26 anastass 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 }
virtual double energy() const GCC11_FINAL
energy
CaloTowerCandidateCreator(const edm::ParameterSet &)
constructor from parameter set
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:26
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
edm::InputTag mSource
label of source collection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
void produce(edm::Event &e, const edm::EventSetup &)
process one event
tuple cout
Definition: gather_cfg.py:121
double et(double vtxZ) const
Definition: CaloTower.h:101
edm::Ref< CaloTowerCollection > CaloTowerRef
Definition: CaloTowerFwd.h:16