CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloConeSelector.cc
Go to the documentation of this file.
4 
6  geom_(geom),deltaR_(dR),detector_(DetId::Detector(0)),subdet_(0) {
7 }
8 
9 CaloConeSelector::CaloConeSelector(double dR, const CaloGeometry* geom, DetId::Detector detector, int subdet) :
10  geom_(geom),deltaR_(dR),detector_(detector),subdet_(subdet) {
11 }
12 
13 std::auto_ptr<CaloRecHitMetaCollectionV> CaloConeSelector::select(double eta, double phi, const CaloRecHitMetaCollectionV& inputCollection) {
14  GlobalPoint p(GlobalPoint::Cylindrical(1,phi,tanh(eta)));
15  return select(p,inputCollection);
16 }
17 
18 std::auto_ptr<CaloRecHitMetaCollectionV> CaloConeSelector::select(const GlobalPoint& p, const CaloRecHitMetaCollectionV& inputCollection) {
20 
21  // TODO: handle default setting of detector_ (loops over subdet)
22  // TODO: heuristics of when it is better to loop over inputCollection instead (small # hits)
23  for (int subdet=subdet_; subdet<=7 && (subdet_==0 || subdet_==subdet); subdet++) {
25  if (sdg!=0) {
26  // get the list of detids within range (from geometry)
28  // loop over detids...
29  CaloRecHitMetaCollectionV::const_iterator j,je=inputCollection.end();
30 
31  for (CaloSubdetectorGeometry::DetIdSet::iterator i=dis.begin(); i!=dis.end(); i++) {
32  if (i->subdetId()!=subdet) continue; // possible for HCAL where the same geometry object handles all the detectors
33  j=inputCollection.find(*i);
34  if (j!=je) c->add(&(*j));
35  }
36  }
37  }
38 
39  return std::auto_ptr<CaloRecHitMetaCollectionV>(c);
40 }
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< CaloRecHitMetaCollectionV > select(double eta, double phi, const CaloRecHitMetaCollectionV &inputCollection)
CaloConeSelector(double dR, const CaloGeometry *geom)
double deltaR_
T eta() const
void add(const CaloRecHit *hit)
add an item to the collection
const_iterator end() const
get the ending iterator
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
int j
Definition: DBlmapReader.cc:9
Definition: DetId.h:20
Detector
Definition: DetId.h:26
DetId::Detector detector_
const CaloGeometry * geom_
Definition: DDAxes.h:10