CMS 3D CMS Logo

CaloDualConeSelector.h
Go to the documentation of this file.
1 #ifndef RECOCALOTOOLS_SELECTORS_CALODUALCONESELECTOR_H
2 #define RECOCALOTOOLS_SELECTORS_CALODUALCONESELECTOR_H 1
3 
7 #include <memory>
8 #include <functional>
9 
14 template <class T>
16 public:
17  CaloDualConeSelector(double dRmin, double dRmax, const CaloGeometry* geom)
19 
20  CaloDualConeSelector(double dRmin, double dRmax, const CaloGeometry* geom, DetId::Detector detector, int subdet = 0)
21  : geom_(geom), deltaRmin_(dRmin), deltaRmax_(dRmax), detector_(detector), subdet_(subdet) {}
22 
23  void inline selectCallback(double eta,
24  double phi,
26  std::function<void(const T&)> callback) {
29  }
30 
31  void inline selectCallback(const GlobalPoint& p,
33  std::function<void(const T&)> callback) {
34  // TODO: handle default setting of detector_ (loops over subdet)
35  // TODO: heuristics of when it is better to loop over inputCollection instead (small # hits)
36  for (int subdet = subdet_; subdet <= 7 && (subdet_ == 0 || subdet_ == subdet); subdet++) {
38  if (sdg != nullptr) {
39  // get the list of detids within range (from geometry)
42  // use set operations to determine detids in annulus
45  dis_all.begin(), dis_all.end(), dis_excl.begin(), dis_excl.end(), std::inserter(dis, dis.begin()));
46 
47  // loop over detids...
49 
50  for (CaloSubdetectorGeometry::DetIdSet::iterator i = dis.begin(); i != dis.end(); i++) {
51  if (i->subdetId() != subdet)
52  continue; // possible for HCAL where the same geometry object handles all the detectors
53  j = inputCollection.find(*i);
54  if (j != je)
55  callback(*j);
56  }
57  }
58  }
59  }
60 
61 private:
65  int subdet_;
66 };
67 
68 #endif
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
std::vector< T >::const_iterator const_iterator
CaloDualConeSelector(double dRmin, double dRmax, const CaloGeometry *geom)
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
const CaloGeometry * geom_
CaloDualConeSelector(double dRmin, double dRmax, const CaloGeometry *geom, DetId::Detector detector, int subdet=0)
Definition: DetId.h:17
Detector
Definition: DetId.h:24
void selectCallback(const GlobalPoint &p, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
long double T
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)