59 #include "Math/GenVector/VectorUtil.h"
60 #include "Math/GenVector/PxPyPzE4D.h"
76 std::unique_ptr<JetCrystalsAssociationCollection> associate(
91 produces<reco::JetCrystalsAssociationCollection>();
92 produces<reco::EMLorentzVectorCollection>();
119 using namespace reco;
143 auto jetRecHits = std::make_unique<EMLorentzVectorCollection>();
145 for (
size_t t = 0;
t <
jets->size();
t++)
147 const std::vector<CaloTowerPtr> myTowers=(*jets)[
t].getCaloConstituents();
150 for (
unsigned int iTower = 0; iTower < myTowers.size(); iTower++)
153 size_t numRecHits = theTower->constituentsSize();
155 for (
size_t j = 0;
j < numRecHits;
j++) {
156 DetId RecHitDetID=theTower->constituent(
j);
159 int EcalNum = RecHitDetID.
subdetId();
164 DetId id = theRecHit->detid();
168 double energy = theRecHit->energy();
173 double et = energy *
sin(theta);
176 jetRecHits->push_back(p);
179 }
else if ( EcalNum == 2 ) {
183 DetId id = theRecHit->detid();
187 double energy = theRecHit->energy();
192 double et = energy *
sin(theta);
195 jetRecHits->push_back(p);
206 iEvent.
put(associate(
jets,myRecHits));
214 auto outputCollection = std::make_unique<JetCrystalsAssociationCollection>(jets->size());
217 for (
size_t j = 0;
j < jets->size();
j++) {
219 for (
size_t t = 0;
t < myLorentzRecHits->size();
t++) {
221 if (delta < m_deltaRCut)
225 return outputCollection;
edm::InputTag m_EBRecHits
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::unique_ptr< JetCrystalsAssociationCollection > associate(const edm::Handle< CaloJetCollection > &jets, const edm::OrphanHandle< EMLorentzVectorCollection > &myLorentzRecHits) const
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< EcalRecHit >::const_iterator const_iterator
Geom::Theta< T > theta() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
Geom::Theta< T > theta() const
math::PtEtaPhiELorentzVectorRef EMLorentzVectorRef
edm::InputTag m_EERecHits
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::Ref< CaloJetCollection > CaloJetRef
edm references
math::PtEtaPhiELorentzVector EMLorentzVector
Geom::Phi< T > phi() const
ESHandle< TrackerGeometry > geometry
Detector det() const
get the detector field from this detid
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
JetCrystalsAssociator(const edm::ParameterSet &)