CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
DetHitAccess Class Reference

#include <DetHitAccess.h>

Public Types

enum  accessMode { standard, rphi, rphi_stereo }
 

Public Member Functions

 DetHitAccess ()
 
 DetHitAccess (const SiStripRecHit2DCollection *rphiRecHits, const SiStripRecHit2DCollection *stereoRecHits, const SiStripMatchedRecHit2DCollection *matchedRecHits, const SiPixelRecHitCollection *pixelRecHits)
 
std::vector< TrackingRecHit * > getHitVector (const DetId *detid)
 
void setCollections (const SiStripRecHit2DCollection *rphiRecHits, const SiStripRecHit2DCollection *stereoRecHits, const SiStripMatchedRecHit2DCollection *matchedRecHits, const SiPixelRecHitCollection *pixelRecHits)
 
void setMode (accessMode input)
 
void use_rphiRecHits (bool input)
 
void use_stereoRecHits (bool input)
 
 ~DetHitAccess ()
 

Private Attributes

accessMode accessMode_
 
const
SiStripMatchedRecHit2DCollection
matchedHits_
 
const SiPixelRecHitCollectionpixelHits_
 
const SiStripRecHit2DCollectionrphiHits_
 
const SiStripRecHit2DCollectionstereoHits_
 
bool use_rphiRecHits_
 
bool use_stereoRecHits_
 

Detailed Description

Definition at line 22 of file DetHitAccess.h.

Member Enumeration Documentation

Enumerator
standard 
rphi 
rphi_stereo 

Definition at line 26 of file DetHitAccess.h.

Constructor & Destructor Documentation

DetHitAccess::DetHitAccess ( )

Definition at line 15 of file DetHitAccess.cc.

References accessMode_, standard, and use_rphiRecHits_.

15  {
16  // default for access mode
18 
19  use_rphiRecHits_ = true;
20  use_rphiRecHits_ = true;
21 }
bool use_rphiRecHits_
Definition: DetHitAccess.h:52
accessMode accessMode_
Definition: DetHitAccess.h:50
DetHitAccess::~DetHitAccess ( )

Definition at line 23 of file DetHitAccess.cc.

23  {
24 }
DetHitAccess::DetHitAccess ( const SiStripRecHit2DCollection rphiRecHits,
const SiStripRecHit2DCollection stereoRecHits,
const SiStripMatchedRecHit2DCollection matchedRecHits,
const SiPixelRecHitCollection pixelRecHits 
)

Definition at line 26 of file DetHitAccess.cc.

References accessMode_, setCollections(), standard, use_rphiRecHits_, and use_stereoRecHits_.

29  {
30 
31  // default for access mode
33 
34  use_rphiRecHits_ = true;
35  use_stereoRecHits_ = true;
36 
37  // set collections
38  setCollections(rphiRecHits,stereoRecHits,matchedRecHits,pixelRecHits);
39 
40 }
void setCollections(const SiStripRecHit2DCollection *rphiRecHits, const SiStripRecHit2DCollection *stereoRecHits, const SiStripMatchedRecHit2DCollection *matchedRecHits, const SiPixelRecHitCollection *pixelRecHits)
Definition: DetHitAccess.cc:42
bool use_stereoRecHits_
Definition: DetHitAccess.h:53
bool use_rphiRecHits_
Definition: DetHitAccess.h:52
accessMode accessMode_
Definition: DetHitAccess.h:50

Member Function Documentation

std::vector< TrackingRecHit * > DetHitAccess::getHitVector ( const DetId detid)

Definition at line 55 of file DetHitAccess.cc.

References accessMode_, Clusterizer1DCommons::add(), edmNew::DetSet< T >::begin(), detSetOrEmpty(), edmNew::DetSet< T >::end(), StripSubdetector::glued(), TrackingRecHit::localPosition(), matchedHits_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelHits_, rphi, rphi_stereo, rphiHits_, stereoHits_, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, use_rphiRecHits_, use_stereoRecHits_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromRingsOneInnerOneOuter(), RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromRingsOneInnerTwoOuter(), RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromRingsTwoInnerOneOuter(), and RoadSearchCloudMakerAlgorithm::FillRecHitsIntoCloudGeneral().

55  {
56  //
57  //DetId that is given to getHitVector is *always* rphi
58  //
59 
60  std::vector<TrackingRecHit*> RecHitVec;
61 
62  if ( (unsigned int)detid->subdetId() == StripSubdetector::TIB
63  || (unsigned int)detid->subdetId() == StripSubdetector::TOB
64  || (unsigned int)detid->subdetId() == StripSubdetector::TID
65  || (unsigned int)detid->subdetId() == StripSubdetector::TEC ) {
66 
67  StripSubdetector StripDetId(*detid);
68 
69 
70  if (accessMode_ == rphi ) {
71  //
72  //return only r-phi RecHits; in case of double modules eliminate recurring r-phi RecHits
73  //
74  if( !StripDetId.glued() ) {
75  if ( rphiHits_ != 0 ) {
77  for ( SiStripRecHit2DCollection::DetSet::const_iterator rphiDetHit = rphiDetHits.begin();
78  rphiDetHit != rphiDetHits.end();
79  ++rphiDetHit ) {
80  RecHitVec.push_back((TrackingRecHit*)(&(*rphiDetHit)));
81  }
82  } else {
83  edm::LogWarning("RoadSearch") << "rphi RecHit collection not set properly";
84  }
85  } else {
86  if ( matchedHits_ != 0 ) {
87  DetId useDetId(StripDetId.glued());
89  for ( SiStripMatchedRecHit2DCollection::DetSet::const_iterator matchedDetHit = matchedDetHits.begin();
90  matchedDetHit != matchedDetHits.end(); ++matchedDetHit ) {
91  bool add = true;
92  TrackingRecHit *rphi = (TrackingRecHit*)matchedDetHit->monoHit();
93  for ( std::vector<TrackingRecHit*>::iterator hit = RecHitVec.begin();
94  hit != RecHitVec.end();
95  ++hit ) {
96  if ((*hit)->localPosition().x() == rphi->localPosition().x()) {
97  if ((*hit)->localPosition().y() == rphi->localPosition().y()) {
98  add = false;
99  break;
100  }
101  }
102  }
103  if ( add ) {
104  RecHitVec.push_back(rphi);
105  }
106  }
107  } else {
108  edm::LogWarning("RoadSearch") << "matched RecHit collection not set properly";
109  }
110  }
111  } else if (accessMode_ == rphi_stereo ) {
112  //
113  //return only r-phi and stereo RecHits
114  //
115  if( !StripDetId.glued() ) {
116  if ( rphiHits_ != 0 ) {
118  for ( SiStripRecHit2DCollection::DetSet::const_iterator rphiDetHit = rphiDetHits.begin();
119  rphiDetHit != rphiDetHits.end();
120  ++rphiDetHit ) {
121  RecHitVec.push_back((TrackingRecHit*)(&(*rphiDetHit)));
122  }
123  } else {
124  edm::LogWarning("RoadSearch") << "rphi RecHit collection not set properly";
125  }
126 
127  } else {
128  DetId rphiDetId(StripDetId.glued()+2);
129  if ( rphiHits_ != 0 ) {
130  SiStripRecHit2DCollection::DetSet rphiDetHits = detSetOrEmpty(*rphiHits_, rphiDetId);
131  for ( SiStripRecHit2DCollection::DetSet::const_iterator rphiDetHit = rphiDetHits.begin();
132  rphiDetHit != rphiDetHits.end();
133  ++rphiDetHit ) {
134  RecHitVec.push_back((TrackingRecHit*)(&(*rphiDetHit)));
135  }
136  } else {
137  edm::LogWarning("RoadSearch") << "rphi RecHit collection not set properly";
138  }
139 
140  DetId stereoDetId(StripDetId.glued()+1);
141  if ( stereoHits_ != 0 ) {
142  SiStripRecHit2DCollection::DetSet stereoDetHits = detSetOrEmpty(*stereoHits_, stereoDetId);
143  for ( SiStripRecHit2DCollection::DetSet::const_iterator stereoDetHit = stereoDetHits.begin();
144  stereoDetHit != stereoDetHits.end();
145  ++stereoDetHit ) {
146  RecHitVec.push_back((TrackingRecHit*)(&(*stereoDetHit)));
147  }
148  } else {
149  edm::LogWarning("RoadSearch") << "stereo RecHit collection not set properly";
150  }
151  }
152  } else if (accessMode_ == standard ) {
153  //
154  //single modules: return r-phi RecHits
155  //double modules: return matched RecHits + r-phi RecHits that are not used by matched RecHits
156  //
157  if( !StripDetId.glued() ) {
158  if ( rphiHits_ != 0 ) {
160  for ( SiStripRecHit2DCollection::DetSet::const_iterator rphiDetHit = rphiDetHits.begin();
161  rphiDetHit != rphiDetHits.end();
162  ++rphiDetHit ) {
163  RecHitVec.push_back((TrackingRecHit*)(&(*rphiDetHit)));
164  }
165  } else {
166  edm::LogWarning("RoadSearch") << "rphi RecHit collection not set properly";
167  }
168  } else {
169  if ( matchedHits_ != 0 ) {
170  DetId useDetId(StripDetId.glued());
172  for ( SiStripMatchedRecHit2DCollection::DetSet::const_iterator matchedDetHit = matchedDetHits.begin();
173  matchedDetHit != matchedDetHits.end(); ++matchedDetHit ) {
174  RecHitVec.push_back((TrackingRecHit*)(&(*matchedDetHit)));
175  }
176  } else {
177  edm::LogWarning("RoadSearch") << "matched RecHit collection not set properly";
178  }
179 
180  //check for additional r-phi RecHits (not used by matched RecHits)
181  if(use_rphiRecHits_) {
182  DetId rphiDetId(StripDetId.glued()+2);
183  if ( rphiHits_ != 0 ) {
184  SiStripRecHit2DCollection::DetSet rphiDetHits = detSetOrEmpty(*rphiHits_, rphiDetId);
185  for ( SiStripRecHit2DCollection::DetSet::const_iterator rphiDetHit = rphiDetHits.begin();
186  rphiDetHit != rphiDetHits.end(); ++rphiDetHit ) {
187  bool use_rphi=true;
188  DetId useDetId(StripDetId.glued());
190  //SiStripMatchedRecHit2DCollection::DetSet matchedDetHits = detSetOrEmpty(*matchedHits_, *detid);
191  for ( SiStripMatchedRecHit2DCollection::DetSet::const_iterator matchedDetHit = matchedDetHits.begin();
192  matchedDetHit != matchedDetHits.end(); ++matchedDetHit ) {
193  if (rphiDetHit->localPosition().x()==matchedDetHit->monoHit()->localPosition().x()
194  && rphiDetHit->localPosition().y()==matchedDetHit->monoHit()->localPosition().y() ) {
195  use_rphi=false;
196  break;
197  }
198  }
199  if(use_rphi) RecHitVec.push_back((TrackingRecHit*)(&(*rphiDetHit)));
200  }
201  } else {
202  edm::LogWarning("RoadSearch") << "rphi RecHit collection not set properly";
203  }
204  }
205 
206  //check for additional stereo RecHits (not used by matched RecHits)
207  if(use_stereoRecHits_) {
208  DetId stereoDetId(StripDetId.glued()+1);
209  if ( stereoHits_ != 0 ) {
210  SiStripRecHit2DCollection::DetSet stereoDetHits = detSetOrEmpty(*stereoHits_, stereoDetId);
211  for ( SiStripRecHit2DCollection::DetSet::const_iterator stereoDetHit = stereoDetHits.begin();
212  stereoDetHit != stereoDetHits.end(); ++stereoDetHit ) {
213  bool use_stereo=true;
214  DetId useDetId(StripDetId.glued());
216  //SiStripMatchedRecHit2DCollection::DetSet matchedDetHits = detSetOrEmpty(*matchedHits_, *detid);
217  for ( SiStripMatchedRecHit2DCollection::DetSet::const_iterator matchedDetHit = matchedDetHits.begin();
218  matchedDetHit != matchedDetHits.end(); ++matchedDetHit ) {
219  if (stereoDetHit->localPosition().x()==matchedDetHit->stereoHit()->localPosition().x()
220  && stereoDetHit->localPosition().y()==matchedDetHit->stereoHit()->localPosition().y() ) {
221  use_stereo=false;
222  break;
223  }
224  }
225  if(use_stereo) RecHitVec.push_back((TrackingRecHit*)(&(*stereoDetHit)));
226  }
227  } else {
228  edm::LogWarning("RoadSearch") << "stereo RecHit collection not set properly";
229  }
230  }
231  }
232  }
233 
234  } else if ( (unsigned int)detid->subdetId() == PixelSubdetector::PixelBarrel
235  || (unsigned int)detid->subdetId() == PixelSubdetector::PixelEndcap) {
236 
237  if ( pixelHits_ != 0 ) {
239  for ( SiPixelRecHitCollection::DetSet::const_iterator pixelDetHit = pixelDetHits.begin();
240  pixelDetHit!= pixelDetHits.end(); ++pixelDetHit) {
241  RecHitVec.push_back((TrackingRecHit*)(&(*pixelDetHit)));
242  }
243  } else {
244  edm::LogWarning("RoadSearch") << "pixel RecHit collection not set properly";
245  }
246  } else {
247 
248  edm::LogError("RoadSearch") << "NEITHER PIXEL NOR STRIP DETECTOR ID";
249 
250  }
251 
252 
253  return RecHitVec;
254 }
const SiStripRecHit2DCollection * stereoHits_
Definition: DetHitAccess.h:56
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
T y() const
Definition: PV3DBase.h:57
bool use_stereoRecHits_
Definition: DetHitAccess.h:53
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
const SiPixelRecHitCollection * pixelHits_
Definition: DetHitAccess.h:58
const SiStripRecHit2DCollection * rphiHits_
Definition: DetHitAccess.h:55
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
edmNew::DetSet< T > detSetOrEmpty(const edmNew::DetSetVector< T > &dsv, DetId detid)
I need this because DetHitAccess assumes that it can search a hit container using a detid which is no...
Definition: DetHitAccess.cc:5
iterator end()
Definition: DetSetNew.h:59
const SiStripMatchedRecHit2DCollection * matchedHits_
Definition: DetHitAccess.h:57
T x() const
Definition: PV3DBase.h:56
virtual LocalPoint localPosition() const =0
bool use_rphiRecHits_
Definition: DetHitAccess.h:52
accessMode accessMode_
Definition: DetHitAccess.h:50
iterator begin()
Definition: DetSetNew.h:56
void DetHitAccess::setCollections ( const SiStripRecHit2DCollection rphiRecHits,
const SiStripRecHit2DCollection stereoRecHits,
const SiStripMatchedRecHit2DCollection matchedRecHits,
const SiPixelRecHitCollection pixelRecHits 
)

Definition at line 42 of file DetHitAccess.cc.

References matchedHits_, pixelHits_, rphiHits_, and stereoHits_.

Referenced by DetHitAccess(), RoadSearchSeedFinderAlgorithm::run(), and RoadSearchCloudMakerAlgorithm::run().

45  {
46 
47  rphiHits_ = rphiRecHits;
48  stereoHits_ = stereoRecHits;
49  matchedHits_ = matchedRecHits;
50  pixelHits_ = pixelRecHits;
51 
52 }
const SiStripRecHit2DCollection * stereoHits_
Definition: DetHitAccess.h:56
const SiPixelRecHitCollection * pixelHits_
Definition: DetHitAccess.h:58
const SiStripRecHit2DCollection * rphiHits_
Definition: DetHitAccess.h:55
const SiStripMatchedRecHit2DCollection * matchedHits_
Definition: DetHitAccess.h:57
void DetHitAccess::setMode ( accessMode  input)
inline
void DetHitAccess::use_rphiRecHits ( bool  input)
inline
void DetHitAccess::use_stereoRecHits ( bool  input)
inline

Member Data Documentation

accessMode DetHitAccess::accessMode_
private

Definition at line 50 of file DetHitAccess.h.

Referenced by DetHitAccess(), getHitVector(), and setMode().

const SiStripMatchedRecHit2DCollection* DetHitAccess::matchedHits_
private

Definition at line 57 of file DetHitAccess.h.

Referenced by getHitVector(), and setCollections().

const SiPixelRecHitCollection* DetHitAccess::pixelHits_
private

Definition at line 58 of file DetHitAccess.h.

Referenced by getHitVector(), and setCollections().

const SiStripRecHit2DCollection* DetHitAccess::rphiHits_
private

Definition at line 55 of file DetHitAccess.h.

Referenced by getHitVector(), and setCollections().

const SiStripRecHit2DCollection* DetHitAccess::stereoHits_
private

Definition at line 56 of file DetHitAccess.h.

Referenced by getHitVector(), and setCollections().

bool DetHitAccess::use_rphiRecHits_
private

Definition at line 52 of file DetHitAccess.h.

Referenced by DetHitAccess(), getHitVector(), and use_rphiRecHits().

bool DetHitAccess::use_stereoRecHits_
private

Definition at line 53 of file DetHitAccess.h.

Referenced by DetHitAccess(), getHitVector(), and use_stereoRecHits().