CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
ParticleTowerProducer Class Reference

#include <RecoHI/ParticleTowerProducer/src/ParticleTowerProducer.cc>

Inheritance diagram for ParticleTowerProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ParticleTowerProducer (const edm::ParameterSet &)
 
 ~ParticleTowerProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
int eta2ieta (double eta) const
 
DetId getNearestTower (const reco::PFCandidate &in) const
 
DetId getNearestTower (double eta, double phi) const
 
int phi2iphi (double phi, int ieta) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void resetTowers (edm::Event &iEvent, const edm::EventSetup &iSetup)
 

Private Attributes

double etaedge [42]
 
CaloGeometry const * geo_
 
double PI
 
TRandom * random_
 
edm::EDGetTokenT< reco::PFCandidateCollectionsrc_
 
std::map< DetId, double > towers_
 
bool useHF_
 

Static Private Attributes

static const double etacent []
 
static const double etatow []
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 25 of file ParticleTowerProducer.h.

Constructor & Destructor Documentation

ParticleTowerProducer::ParticleTowerProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 59 of file ParticleTowerProducer.cc.

References edm::ParameterSet::getParameter(), Pi, PI, random_, src_, and useHF_.

59  : geo_(nullptr) {
60  //register your products
61  src_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("src"));
62  useHF_ = iConfig.getParameter<bool>("useHF");
63 
64  produces<CaloTowerCollection>();
65 
66  //now do what ever other initialization is needed
67  random_ = new TRandom();
68  PI = TMath::Pi();
69 }
const double Pi
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFCandidateCollection > src_
CaloGeometry const * geo_
ParticleTowerProducer::~ParticleTowerProducer ( )
override

Definition at line 71 of file ParticleTowerProducer.cc.

References random_.

71  {
72  // do anything here that needs to be done at desctruction time
73  // (e.g. close files, deallocate resources etc.)
74  delete random_;
75 }

Member Function Documentation

void ParticleTowerProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 190 of file ParticleTowerProducer.cc.

References etacent, etaedge, etatow, mps_fire::i, and useHF_.

190  {
191  // tower edges from fast sim, used starting at index 30 for the HF
192  const double etatow[42] = {0.000, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870,
193  0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830,
194  1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853, 3.000, 3.139, 3.314, 3.489,
195  3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.716, 4.889, 5.191};
196 
197  // tower centers derived directly from by looping over HCAL towers and printing out the values, used up until eta = 3 where the HF/Endcap interface becomes problematic
198  const double etacent[40] = {
199  0.0435, // 1
200  0.1305, // 2
201  0.2175, // 3
202  0.3045, // 4
203  0.3915, // 5
204  0.4785, // 6
205  0.5655, // 7
206  0.6525, // 8
207  0.7395, // 9
208  0.8265, // 10
209  0.9135, // 11
210  1.0005, // 12
211  1.0875, // 13
212  1.1745, // 14
213  1.2615, // 15
214  1.3485, // 16
215  1.4355, // 17
216  1.5225, // 18
217  1.6095, // 19
218  1.6965, // 20
219  1.785, // 21
220  1.88, // 22
221  1.9865, // 23
222  2.1075, // 24
223  2.247, // 25
224  2.411, // 26
225  2.575, // 27
226  2.759, // 28
227  2.934, // 29
228  2.90138, // 29
229  3.04448, // 30
230  3.21932, // 31
231  3.39462, // 32
232  3.56966, // 33
233  3.74485, // 34
234  3.91956, // 35
235  4.09497, // 36
236  4.27007, // 37
237  4.44417, // 38
238  4.62046 // 39
239  };
240 
241  // Use the real towers centrers for the barrel and endcap up to eta=3
242  etaedge[0] = 0.;
243  for (int i = 1; i < 30; i++) {
244  etaedge[i] = (etacent[i - 1] - etaedge[i - 1]) * 2.0 + etaedge[i - 1];
245  //std::cout<<" i "<<i<<" etaedge "<<etaedge[i]<<std::endl;
246  }
247  // beyond eta = 3 just use the fast sim values
248  if (useHF_) {
249  for (int i = 30; i < 42; i++) {
250  etaedge[i] = etatow[i];
251  //std::cout<<" i "<<i<<" etaedge "<<etaedge[i]<<std::endl;
252  }
253  }
254 }
static const double etatow[]
static const double etacent[]
void ParticleTowerProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 257 of file ParticleTowerProducer.cc.

257 {}
int ParticleTowerProducer::eta2ieta ( double  eta) const
private

Definition at line 443 of file ParticleTowerProducer.cc.

References gather_cfg::cout, etaedge, findQualityFiles::size, useHF_, and x.

Referenced by produce().

443  {
444  // binary search in the array of towers eta edges
445 
446  int size = 42;
447  if (!useHF_)
448  size = 30;
449 
450  if (fabs(eta) > etaedge[size - 1])
451  return -1;
452 
453  double x = fabs(eta);
454  int curr = size / 2;
455  int step = size / 4;
456  int iter;
457  int prevdir = 0;
458  int actudir = 0;
459 
460  for (iter = 0; iter < size; iter++) {
461  if (curr >= size || curr < 1)
462  std::cout << " ParticleTowerProducer::eta2ieta - wrong current index = " << curr << " !!!" << std::endl;
463 
464  if ((x <= etaedge[curr]) && (x > etaedge[curr - 1]))
465  break;
466  prevdir = actudir;
467  if (x > etaedge[curr]) {
468  actudir = 1;
469  } else {
470  actudir = -1;
471  }
472  if (prevdir * actudir < 0) {
473  if (step > 1)
474  step /= 2;
475  }
476  curr += actudir * step;
477  if (curr > size)
478  curr = size;
479  else {
480  if (curr < 1) {
481  curr = 1;
482  }
483  }
484 
485  /*
486  std::cout << " HCALProperties::eta2ieta end of iter." << iter
487  << " curr, etaedge[curr-1], etaedge[curr] = "
488  << curr << " " << etaedge[curr-1] << " " << etaedge[curr] << std::endl;
489  */
490  }
491 
492  /*
493  std::cout << " HCALProperties::eta2ieta for input x = " << x
494  << " found index = " << curr-1
495  << std::endl;
496  */
497 
498  return curr;
499 }
size
Write out results.
step
Definition: StallMonitor.cc:94
DetId ParticleTowerProducer::getNearestTower ( const reco::PFCandidate in) const
private

Definition at line 291 of file ParticleTowerProducer.cc.

References funct::abs(), reco::deltaR(), PbPb_ZMuSkimMuonDPG_cff::deltaR, HcalDetId::depth(), PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), reco::LeafCandidate::eta(), geo_, CaloGeometry::getGeometry(), CaloGeometry::getValidDetIds(), DetId::Hcal, LEDCalibrationChannels::ieta, HLT_2018_cff::minDeltaR, phi, PV3DBase< T, PVType, FrameType >::phi(), and reco::LeafCandidate::phi().

291  {
292  double eta = in.eta();
293  double phi = in.phi();
294 
295  double minDeltaR = 9999;
296 
297  std::vector<DetId> alldid = geo_->getValidDetIds();
298 
299  DetId returnId;
300 
301  //int nclosetowers=0;
302 
303  for (std::vector<DetId>::const_iterator did = alldid.begin(); did != alldid.end(); did++) {
304  if ((*did).det() == DetId::Hcal) {
305  HcalDetId hid(*did);
306 
307  // which layer is irrelevant for an eta-phi map, no?
308 
309  if (hid.depth() != 1)
310  continue;
311 
312  GlobalPoint pos = geo_->getGeometry(hid)->getPosition();
313 
314  double hcalEta = pos.eta();
315  double hcalPhi = pos.phi();
316 
317  //std::cout<<" transverse distance = "<<sqrt(pos.x()*pos.x()+pos.y()*pos.y())<<std::endl;
318 
319  //std::cout<<" ieta "<<(hid).ieta()<<" iphi "<<(hid).iphi()<<" hcalEta "<<hcalEta<<" hcalPhi "<<hcalPhi<<std::endl;
320 
321  double deltaR = reco::deltaR(eta, phi, hcalEta, hcalPhi);
322 
323  // need to factor in the size of the tower
324  double towersize = 0.087;
325 
326  int ieta = (hid).ieta();
327 
328  if (abs(ieta) > 21) {
329  if (abs(ieta) > 29)
330  towersize = 0.175;
331  else {
332  if (abs(ieta) == 22)
333  towersize = 0.1;
334  else if (abs(ieta) == 23)
335  towersize = 0.113;
336  else if (abs(ieta) == 24)
337  towersize = 0.129;
338  else if (abs(ieta) == 25)
339  towersize = 0.16;
340  else if (abs(ieta) == 26)
341  towersize = 0.168;
342  else if (abs(ieta) == 27)
343  towersize = 0.15;
344  else if (abs(ieta) == 28)
345  towersize = 0.218;
346  else if (abs(ieta) == 29)
347  towersize = 0.132;
348  }
349  }
350 
351  deltaR /= towersize;
352  //if(deltaR<1/3.) nclosetowers++;
353 
354  if (deltaR < minDeltaR) {
355  returnId = DetId(*did);
356  minDeltaR = deltaR;
357  }
358 
359  //if(abs(eta-hcalEta)<towersize/2. && abs(phi-hcalPhi)<towersize/2.) break;
360  }
361  }
362  //if(nclosetowers>1)std::cout<<"eta "<<eta<<" phi "<<phi<<" minDeltaR "<<minDeltaR<<" nclosetowers "<<nclosetowers<<std::endl;
363  return returnId;
364 }
double eta() const final
momentum pseudorapidity
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Definition: DetId.h:17
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
T eta() const
Definition: PV3DBase.h:73
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
CaloGeometry const * geo_
double phi() const final
momentum azimuthal angle
DetId ParticleTowerProducer::getNearestTower ( double  eta,
double  phi 
) const
private

Definition at line 366 of file ParticleTowerProducer.cc.

References funct::abs(), reco::deltaR(), PbPb_ZMuSkimMuonDPG_cff::deltaR, HcalDetId::depth(), PV3DBase< T, PVType, FrameType >::eta(), geo_, CaloGeometry::getGeometry(), CaloGeometry::getValidDetIds(), DetId::Hcal, LEDCalibrationChannels::ieta, HLT_2018_cff::minDeltaR, and PV3DBase< T, PVType, FrameType >::phi().

366  {
367  // get closest tower by delta R matching
368  // Now obsolute, instead use faster premade eta-phi grid
369 
370  double minDeltaR = 9999;
371 
372  std::vector<DetId> alldid = geo_->getValidDetIds();
373 
374  DetId returnId;
375 
376  //int nclosetowers=0;
377 
378  for (std::vector<DetId>::const_iterator did = alldid.begin(); did != alldid.end(); did++) {
379  if ((*did).det() == DetId::Hcal) {
380  HcalDetId hid(*did);
381 
382  // which layer is irrelevant for an eta-phi map, no?
383 
384  if (hid.depth() != 1)
385  continue;
386 
387  GlobalPoint pos = geo_->getGeometry(hid)->getPosition();
388 
389  double hcalEta = pos.eta();
390  double hcalPhi = pos.phi();
391 
392  //std::cout<<" transverse distance = "<<sqrt(pos.x()*pos.x()+pos.y()*pos.y())<<std::endl;
393 
394  //std::cout<<" ieta "<<(hid).ieta()<<" iphi "<<(hid).iphi()<<" hcalEta "<<hcalEta<<" hcalPhi "<<hcalPhi<<std::endl;
395 
396  double deltaR = reco::deltaR(eta, phi, hcalEta, hcalPhi);
397 
398  // need to factor in the size of the tower
399  double towersize = 0.087;
400 
401  int ieta = (hid).ieta();
402 
403  if (abs(ieta) > 21) {
404  if (abs(ieta) > 29)
405  towersize = 0.175;
406  else {
407  if (abs(ieta) == 22)
408  towersize = 0.1;
409  else if (abs(ieta) == 23)
410  towersize = 0.113;
411  else if (abs(ieta) == 24)
412  towersize = 0.129;
413  else if (abs(ieta) == 25)
414  towersize = 0.16;
415  else if (abs(ieta) == 26)
416  towersize = 0.168;
417  else if (abs(ieta) == 27)
418  towersize = 0.15;
419  else if (abs(ieta) == 28)
420  towersize = 0.218;
421  else if (abs(ieta) == 29)
422  towersize = 0.132;
423  }
424  }
425 
426  deltaR /= towersize;
427  //if(deltaR<1/3.) nclosetowers++;
428 
429  if (deltaR < minDeltaR) {
430  returnId = DetId(*did);
431  minDeltaR = deltaR;
432  }
433 
434  //if(abs(eta-hcalEta)<towersize/2. && abs(phi-hcalPhi)<towersize/2.) break;
435  }
436  }
437  //if(nclosetowers>1)std::cout<<"eta "<<eta<<" phi "<<phi<<" minDeltaR "<<minDeltaR<<" nclosetowers "<<nclosetowers<<std::endl;
438  return returnId;
439 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Definition: DetId.h:17
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
T eta() const
Definition: PV3DBase.h:73
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
CaloGeometry const * geo_
int ParticleTowerProducer::phi2iphi ( double  phi,
int  ieta 
) const
private

Definition at line 501 of file ParticleTowerProducer.cc.

References funct::abs(), createfilelist::int, LEDCalibrationChannels::iphi, and PI.

Referenced by produce().

501  {
502  if (phi < 0)
503  phi += 2. * PI;
504  else if (phi > 2. * PI)
505  phi -= 2. * PI;
506 
507  int iphi = (int)TMath::Ceil(phi / 2.0 / PI * 72.);
508  // take into account larger granularity in endcap (x2) and at the end of the HF (x4)
509  if (abs(ieta) > 20) {
510  if (abs(ieta) < 40)
511  iphi -= (iphi + 1) % 2;
512  else {
513  iphi -= (iphi + 1) % 4;
514  if (iphi == -1)
515  iphi = 71;
516  }
517  }
518 
519  return iphi;
520 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void ParticleTowerProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 82 of file ParticleTowerProducer.cc.

References funct::abs(), EgHLTOffHistBins_cfi::et, reco::LeafCandidate::et(), PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), reco::LeafCandidate::eta(), eta2ieta(), geo_, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getGeometry(), HcalBarrel, HcalEndcap, HcalForward, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, eostools::move(), p4, PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::phi(), phi2iphi(), dumpMFGeometry_cfg::prod, edm::ESHandle< T >::product(), edm::Event::put(), resetTowers(), sd, src_, towers_, and useHF_.

82  {
83  using namespace edm;
84 
85  if (!geo_) {
87  iSetup.get<CaloGeometryRecord>().get(pG);
88  geo_ = pG.product();
89  }
90 
91  resetTowers(iEvent, iSetup);
92 
94  iEvent.getByToken(src_, inputsHandle);
95 
96  for (reco::PFCandidateCollection::const_iterator ci = inputsHandle->begin(); ci != inputsHandle->end(); ++ci) {
97  const reco::PFCandidate& particle = *ci;
98 
99  // put a cutoff if you want
100  //if(particle.et() < 0.3) continue;
101 
102  double eta = particle.eta();
103 
104  if (!useHF_ && fabs(eta) > 3.)
105  continue;
106 
107  int ieta = eta2ieta(eta);
108  if (ieta == -1)
109  continue;
110  if (eta < 0)
111  ieta *= -1;
112 
113  int iphi = phi2iphi(particle.phi(), ieta);
114 
116  if (abs(ieta) <= 16)
117  sd = HcalBarrel;
118  else if (fabs(eta) < 3.)
119  sd = HcalEndcap; // Use the endcap until eta =3
120  else
121  sd = HcalForward;
122 
123  HcalDetId hid = HcalDetId(sd, ieta, iphi, 1); // assume depth=1
124 
125  // check against the old method (boundaries slightly shifted in the endcaps
126  /*
127  HcalDetId hid_orig = getNearestTower(particle);
128 
129  if(hid != hid_orig)
130  {
131  if(abs((hid).ieta()-(hid_orig).ieta())>1 || abs((hid).iphi()-(hid_orig).iphi()) >1 ){
132 
133  int phi_diff = 1;
134  if(abs((hid).ieta())>39 || abs((hid_orig).ieta())>39) phi_diff = 4;
135  else if(abs((hid).ieta())>20 || abs((hid_orig).ieta())>20) phi_diff = 2;
136 
137  if(abs((hid).ieta()-(hid_orig).ieta()) > 1 || abs((hid).iphi()-(hid_orig).iphi()) > phi_diff ){
138  std::cout<<" eta "<<eta<<std::endl;
139  std::cout<<" hid "<<hid<<std::endl;
140  std::cout<<" old method "<<hid_orig<<std::endl;
141  }
142  }
143  }
144  */
145  towers_[hid] += particle.et();
146  }
147 
148  auto prod = std::make_unique<CaloTowerCollection>();
149 
150  for (std::map<DetId, double>::const_iterator iter = towers_.begin(); iter != towers_.end(); ++iter) {
151  HcalDetId id = HcalDetId(iter->first);
152  CaloTowerDetId newTowerId(id.ieta(), id.iphi());
153  double et = iter->second;
154 
155  if (et > 0) {
156  GlobalPoint pos = geo_->getGeometry(newTowerId)->getPosition();
157 
158  if (!useHF_ && fabs(pos.eta()) > 3.)
159  continue;
160 
161  // currently sets et = pt, mass to zero
162  // pt, eta , phi, mass
163  reco::Particle::PolarLorentzVector p4(et, pos.eta(), pos.phi(), 0.);
164 
165  CaloTower newTower(newTowerId, et, 0, 0, 0, 0, p4, pos, pos);
166  prod->push_back(newTower);
167  }
168  }
169 
170  //For reference, Calo Tower Constructors
171 
172  /*
173  CaloTower(const CaloTowerDetId& id,
174  double emE, double hadE, double outerE,
175  int ecal_tp, int hcal_tp,
176  const PolarLorentzVector p4,
177  GlobalPoint emPosition, GlobalPoint hadPosition);
178 
179  CaloTower(const CaloTowerDetId& id,
180  double emE, double hadE, double outerE,
181  int ecal_tp, int hcal_tp,
182  const LorentzVector p4,
183  GlobalPoint emPosition, GlobalPoint hadPosition);
184  */
185 
186  iEvent.put(std::move(prod));
187 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
double eta() const final
momentum pseudorapidity
int phi2iphi(double phi, int ieta) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void resetTowers(edm::Event &iEvent, const edm::EventSetup &iSetup)
double et() const final
transverse energy
double p4[4]
Definition: TauolaWrapper.h:92
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int eta2ieta(double eta) const
double sd
edm::EDGetTokenT< reco::PFCandidateCollection > src_
T eta() const
Definition: PV3DBase.h:73
std::map< DetId, double > towers_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
HLT enums.
T get() const
Definition: EventSetup.h:73
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
CaloGeometry const * geo_
double phi() const final
momentum azimuthal angle
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
void ParticleTowerProducer::resetTowers ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 259 of file ParticleTowerProducer.cc.

References HcalDetId::depth(), PV3DBase< T, PVType, FrameType >::eta(), geo_, CaloGeometry::getGeometry(), CaloGeometry::getValidDetIds(), DetId::Hcal, towers_, and useHF_.

Referenced by produce().

259  {
260  std::vector<DetId> alldid = geo_->getValidDetIds();
261 
262  for (std::vector<DetId>::const_iterator did = alldid.begin(); did != alldid.end(); did++) {
263  if ((*did).det() == DetId::Hcal) {
264  HcalDetId hid = HcalDetId(*did);
265  if (hid.depth() == 1) {
266  if (!useHF_) {
267  GlobalPoint pos = geo_->getGeometry(hid)->getPosition();
268  //if((hid).iphi()==1)std::cout<<" ieta "<<(hid).ieta()<<" eta "<<pos.eta()<<" iphi "<<(hid).iphi()<<" phi "<<pos.phi()<<std::endl;
269  if (fabs(pos.eta()) > 3.)
270  continue;
271  }
272  towers_[(*did)] = 0.;
273  }
274  }
275  }
276 
277  //print out tower eta boundaries
278  /*
279  int current_ieta=0;
280  float testphi =0.;
281  for(double testeta=1.7; testeta<=5.4;testeta+=0.00001){
282  HcalDetId hid = getNearestTower(testeta,testphi);
283  if((hid).ieta()!=current_ieta) {
284  std::cout<<" new ieta "<<current_ieta<<" testeta "<<testeta<<std::endl;
285  current_ieta = (hid).ieta();
286  }
287  }
288  */
289 }
int depth() const
get the tower depth
Definition: HcalDetId.h:164
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
T eta() const
Definition: PV3DBase.h:73
std::map< DetId, double > towers_
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
CaloGeometry const * geo_

Member Data Documentation

const double ParticleTowerProducer::etacent[]
staticprivate

Definition at line 54 of file ParticleTowerProducer.h.

Referenced by beginJob().

double ParticleTowerProducer::etaedge[42]
private

Definition at line 55 of file ParticleTowerProducer.h.

Referenced by beginJob(), and eta2ieta().

const double ParticleTowerProducer::etatow[]
staticprivate

Definition at line 53 of file ParticleTowerProducer.h.

Referenced by beginJob().

CaloGeometry const* ParticleTowerProducer::geo_
private

Definition at line 51 of file ParticleTowerProducer.h.

Referenced by getNearestTower(), produce(), and resetTowers().

double ParticleTowerProducer::PI
private

Definition at line 48 of file ParticleTowerProducer.h.

Referenced by ParticleTowerProducer(), and phi2iphi().

TRandom* ParticleTowerProducer::random_
private

Definition at line 49 of file ParticleTowerProducer.h.

Referenced by ParticleTowerProducer(), and ~ParticleTowerProducer().

edm::EDGetTokenT<reco::PFCandidateCollection> ParticleTowerProducer::src_
private

Definition at line 43 of file ParticleTowerProducer.h.

Referenced by ParticleTowerProducer(), and produce().

std::map<DetId, double> ParticleTowerProducer::towers_
private

Definition at line 46 of file ParticleTowerProducer.h.

Referenced by produce(), and resetTowers().

bool ParticleTowerProducer::useHF_
private