test
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 #include <cmath>
10 using namespace edm;
11 using namespace reco;
12 using namespace std;
13 
15  :
16  mVerbose (p.getUntrackedParameter<int> ("verbose", 0)),
17  mEtThreshold (p.getParameter<double> ("minimumEt")),
18  mEThreshold (p.getParameter<double> ("minimumE"))
19 {
20  tok_src_ = consumes<CaloTowerCollection> (p.getParameter<edm::InputTag> ("src"));
21 
22  produces<CandidateCollection>();
23 }
24 
26 }
27 
30  evt.getByToken( tok_src_, caloTowers );
31 
32  auto_ptr<CandidateCollection> cands( new CandidateCollection );
33  cands->reserve( caloTowers->size() );
34  unsigned idx = 0;
35  for (; idx < caloTowers->size (); idx++) {
36  const CaloTower* cal = &((*caloTowers) [idx]);
37  if (mVerbose >= 2) {
38  std::cout << "CaloTowerCandidateCreator::produce-> " << idx << " tower et/eta/phi/e: "
39  << cal->et() << '/' << cal->eta() << '/' << cal->phi() << '/' << cal->energy() << " is...";
40  }
41  if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold ) {
42  math::PtEtaPhiMLorentzVector p( cal->et(), cal->eta(), cal->phi(), 0 );
45  c->setCaloTower (CaloTowerRef( caloTowers, idx) );
46  cands->push_back( c );
47  if (mVerbose >= 2) std::cout << "accepted: pT/eta/phi:" << c->pt() << '/' << c->eta() << '/' << c->phi() <<std::endl;
48  }
49  else {
50  if (mVerbose >= 2) std::cout << "rejected" << std::endl;
51  }
52  }
53  if (mVerbose >= 1) {
54  std::cout << "CaloTowerCandidateCreator::produce-> " << cands->size () << " candidates created" << std::endl;
55  }
56  evt.put( cands );
57 }
T getParameter(std::string const &) const
CaloTowerCandidateCreator(const edm::ParameterSet &)
constructor from parameter set
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
virtual double eta() const
momentum pseudorapidity
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
virtual double energy() const
energy
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
edm::EDGetTokenT< CaloTowerCollection > tok_src_
token of source collection
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
mVerbose(fConfig.getUntrackedParameter< bool >("verbose", false))
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:131
edm::Ref< CaloTowerCollection > CaloTowerRef
Definition: CaloTowerFwd.h:16
virtual double phi() const
momentum azimuthal angle