CMS 3D CMS Logo

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

#include <RoadSearchHelixMakerAlgorithm.h>

Public Member Functions

 RoadSearchHelixMakerAlgorithm (const edm::ParameterSet &conf)
 
void run (const TrackCandidateCollection *input, const edm::EventSetup &es, reco::TrackCollection &output)
 Runs the algorithm. More...
 
 ~RoadSearchHelixMakerAlgorithm ()
 

Private Attributes

edm::ParameterSet conf_
 

Detailed Description

Definition at line 29 of file RoadSearchHelixMakerAlgorithm.h.

Constructor & Destructor Documentation

RoadSearchHelixMakerAlgorithm::RoadSearchHelixMakerAlgorithm ( const edm::ParameterSet conf)

Definition at line 55 of file RoadSearchHelixMakerAlgorithm.cc.

55  : conf_(conf) {
56 }
RoadSearchHelixMakerAlgorithm::~RoadSearchHelixMakerAlgorithm ( )

Definition at line 58 of file RoadSearchHelixMakerAlgorithm.cc.

58  {
59 }

Member Function Documentation

void RoadSearchHelixMakerAlgorithm::run ( const TrackCandidateCollection input,
const edm::EventSetup es,
reco::TrackCollection output 
)

Runs the algorithm.

Definition at line 61 of file RoadSearchHelixMakerAlgorithm.cc.

References fieldHandle, edm::EventSetup::get(), LogDebug, GluedGeomDet::monoDet(), edm::ESHandle< class >::product(), TrackCandidate::recHits(), StripTopology::stripLength(), DetId::subdetId(), GeomDet::surface(), StripSubdetector::TIB, StripSubdetector::TOB, Surface::toGlobal(), GeomDetUnit::topology(), patCandidatesForDimuonsSequences_cff::tracker, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by cms::RoadSearchHelixMaker::produce().

64 {
65 
66  edm::LogInfo("RoadSearch") << "Input of " << input->size() << " track candidate(s).";
67 
68  //
69  // no track candidates - nothing to try fitting
70  //
71  if ( input->empty() ){
72  edm::LogInfo("RoadSearch") << "Created " << output.size() << " tracks.";
73  return;
74  }
75 
76  //
77  // got > 0 track candidate - try fitting
78  //
79 
80  // get tracker geometry
82  es.get<TrackerDigiGeometryRecord>().get(tracker);
83 
84  // magnetic field
86  es.get<IdealMagneticFieldRecord>().get(fieldHandle);
87  const MagneticField *field = fieldHandle.product();
88 
89  unsigned int trackcandidate_ctr=0;
90 
91  // loop over clouds
92  for ( TrackCandidateCollection::const_iterator trackcandidate = input->begin(); trackcandidate != input->end(); ++trackcandidate ) {
93  TrackCandidate currentCandidate = *trackcandidate;
94  ++trackcandidate_ctr;
95  unsigned int trackcandidate_number_rechits = 0;
96  TrackCandidate::range recHitRange = currentCandidate.recHits();
97  for ( TrackCandidate::const_iterator recHit = recHitRange.first; recHit != recHitRange.second; ++recHit ) {
98  ++trackcandidate_number_rechits;
99  }
100 
101  LogDebug("RoadSearch") << "Track candidate number, number of TrackingRecHits = " << trackcandidate_ctr << " "
102  << trackcandidate_number_rechits;
103 
104  //
105  // helix fitting here
106  //
107  edm::LogInfo("RoadSearch") << "Beware - Use Simple Helix Fitted Tracks only for Debugging Purposes!!" ;
108 
109  std::vector<DcxHit*> listohits;
110 
111  for ( TrackCandidate::const_iterator recHit = recHitRange.first; recHit != recHitRange.second; ++recHit ) {
112  DetId recHitId = recHit->geographicalId();
113  const GeomDet *recHitGeomDet = tracker->idToDet(recHitId);
114  GlobalPoint hit_global_pos = recHitGeomDet->surface().toGlobal(recHit->localPosition());
115  // only for TIB and TOB (for now ... )
116  if ( (unsigned int)recHitId.subdetId() == StripSubdetector::TIB ||
117  (unsigned int)recHitId.subdetId() == StripSubdetector::TOB ) {
118  const GeomDetUnit *recHitGeomDetUnit;
119  // take rphi sensor in case of matched rechit to determine topology
120  const GluedGeomDet *recHitGluedGeomDet = dynamic_cast<const GluedGeomDet*>(recHitGeomDet);
121  if ( recHitGluedGeomDet != 0 ) {
122  recHitGeomDetUnit = recHitGluedGeomDet->monoDet();
123  } else {
124  recHitGeomDetUnit = tracker->idToDetUnit(recHitId);
125  }
126  const StripTopology *recHitTopology = dynamic_cast<const StripTopology*>(&(recHitGeomDetUnit->topology()));
127  double iLength = recHitTopology->stripLength();
128  LocalPoint temp_lpos = recHit->localPosition();
129  LocalPoint temp_lpos_f(temp_lpos.x(),temp_lpos.y()+iLength/2.0,temp_lpos.z());
130  LocalPoint temp_lpos_b(temp_lpos.x(),temp_lpos.y()-iLength/2.0,temp_lpos.z());
131  GlobalPoint temp_gpos_f = recHitGeomDet->surface().toGlobal(temp_lpos_f);
132  GlobalPoint temp_gpos_b = recHitGeomDet->surface().toGlobal(temp_lpos_b);
133  GlobalVector fir_uvec((temp_gpos_f.x()-temp_gpos_b.x())/iLength,
134  (temp_gpos_f.y()-temp_gpos_b.y())/iLength,(temp_gpos_f.z()-temp_gpos_b.z())/iLength);
135  DcxHit* try_me = new DcxHit(hit_global_pos.x(), hit_global_pos.y(), hit_global_pos.z(),
136  fir_uvec.x(), fir_uvec.y(), fir_uvec.z());
137  listohits.push_back(try_me);
138  }
139  }
140  DcxTrackCandidatesToTracks make_tracks(listohits,output, field);
141  }//iterate over all track candidates
142 
143  edm::LogInfo("RoadSearch") << "Created " << output.size() << " tracks.";
144 
145 }
ESHandle< MagneticField > fieldHandle
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
range recHits() const
T y() const
Definition: PV3DBase.h:62
std::pair< const_iterator, const_iterator > range
virtual const Topology & topology() const =0
virtual float stripLength() const =0
T z() const
Definition: PV3DBase.h:63
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
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
RecHitContainer::const_iterator const_iterator
T x() const
Definition: PV3DBase.h:61

Member Data Documentation

edm::ParameterSet RoadSearchHelixMakerAlgorithm::conf_
private

Definition at line 42 of file RoadSearchHelixMakerAlgorithm.h.