CMS 3D CMS Logo

CaloConeSelector.h
Go to the documentation of this file.
1 #ifndef RECOCALOTOOLS_SELECTORS_CALOCONESELECTOR_H
2 #define RECOCALOTOOLS_SELECTORS_CALOCONESELECTOR_H 1
3 
7 #include <memory>
8 #include <functional>
9 
15 template <class T>
17 public:
20 
21  CaloConeSelector(double dR, const CaloGeometry* geom, DetId::Detector detector, int subdet = 0)
22  : geom_(geom), deltaR_(dR), detector_(detector), subdet_(subdet) {}
23 
24  void inline selectCallback(double eta,
25  double phi,
27  std::function<void(const T&)> callback) {
30  }
31 
32  void inline selectCallback(const GlobalPoint& p,
34  std::function<void(const T&)> callback) {
35  // TODO: handle default setting of detector_ (loops over subdet)
36  // TODO: heuristics of when it is better to loop over inputCollection instead (small # hits)
37  for (int subdet = subdet_; subdet <= 7 && (subdet_ == 0 || subdet_ == subdet); subdet++) {
39  if (sdg != nullptr) {
40  // get the list of detids within range (from geometry)
42  // loop over detids...
44 
45  for (CaloSubdetectorGeometry::DetIdSet::iterator i = dis.begin(); i != dis.end(); i++) {
46  if (i->subdetId() != subdet)
47  continue; // possible for HCAL where the same geometry object handles all the detectors
48  j = inputCollection.find(*i);
49  if (j != je)
50  callback(*j);
51  }
52  }
53  }
54  }
55 
56 private:
58  double deltaR_;
60  int subdet_;
61 };
62 
63 #endif
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
CaloConeSelector(double dR, const CaloGeometry *geom, DetId::Detector detector, int subdet=0)
std::vector< T >::const_iterator const_iterator
void selectCallback(const GlobalPoint &p, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
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.
CaloConeSelector(double dR, const CaloGeometry *geom)
Definition: DetId.h:17
Detector
Definition: DetId.h:24
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
DetId::Detector detector_
long double T
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34