CMS 3D CMS Logo

Public Member Functions | Private Attributes

RoadSearchHelixMakerAlgorithm Class Reference

#include <RoadSearchHelixMakerAlgorithm.h>

List of all members.

Public Member Functions

 RoadSearchHelixMakerAlgorithm (const edm::ParameterSet &conf)
void run (const TrackCandidateCollection *input, const edm::EventSetup &es, reco::TrackCollection &output)
 Runs the algorithm.
 ~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.

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

Definition at line 58 of file RoadSearchHelixMakerAlgorithm.cc.

                                                              {
}

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< T >::product(), TrackCandidate::recHits(), StripTopology::stripLength(), DetId::subdetId(), GeomDet::surface(), StripSubdetector::TIB, sistripsummary::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().

{

  edm::LogInfo("RoadSearch") << "Input of " << input->size() << " track candidate(s)."; 

  //
  //  no track candidates - nothing to try fitting
  //
  if ( input->empty() ){
    edm::LogInfo("RoadSearch") << "Created " << output.size() << " tracks.";
    return;  
  }

  //
  //  got > 0 track candidate - try fitting
  //

  // get tracker geometry
  edm::ESHandle<TrackerGeometry> tracker;
  es.get<TrackerDigiGeometryRecord>().get(tracker);

  // magnetic field
  edm::ESHandle<MagneticField> fieldHandle;
  es.get<IdealMagneticFieldRecord>().get(fieldHandle);
  const MagneticField *field = fieldHandle.product();

  unsigned int trackcandidate_ctr=0;

  // loop over clouds
  for ( TrackCandidateCollection::const_iterator trackcandidate = input->begin(); trackcandidate != input->end(); ++trackcandidate ) {
    TrackCandidate currentCandidate = *trackcandidate;
    ++trackcandidate_ctr;
    unsigned int trackcandidate_number_rechits = 0;
    TrackCandidate::range recHitRange = currentCandidate.recHits();
    for ( TrackCandidate::const_iterator recHit = recHitRange.first; recHit != recHitRange.second; ++recHit ) {
      ++trackcandidate_number_rechits;
    }

    LogDebug("RoadSearch") << "Track candidate number, number of TrackingRecHits = " << trackcandidate_ctr << " " 
                           << trackcandidate_number_rechits; 

    //
    // helix fitting here
    //
    edm::LogInfo("RoadSearch") << "Beware - Use Simple Helix Fitted Tracks only for Debugging Purposes!!" ;

    std::vector<DcxHit*> listohits; 

    for ( TrackCandidate::const_iterator recHit = recHitRange.first; recHit != recHitRange.second; ++recHit ) {
      DetId recHitId = recHit->geographicalId();
      const GeomDet *recHitGeomDet = tracker->idToDet(recHitId);
      GlobalPoint hit_global_pos = recHitGeomDet->surface().toGlobal(recHit->localPosition());
      // only for TIB and TOB (for now ... )
      if ( (unsigned int)recHitId.subdetId() == StripSubdetector::TIB ||
           (unsigned int)recHitId.subdetId() == StripSubdetector::TOB ) {
        const GeomDetUnit *recHitGeomDetUnit;
        // take rphi sensor in case of matched rechit to determine topology
        const GluedGeomDet *recHitGluedGeomDet = dynamic_cast<const GluedGeomDet*>(recHitGeomDet);
        if ( recHitGluedGeomDet != 0 ) {
          recHitGeomDetUnit = recHitGluedGeomDet->monoDet();
        } else {
          recHitGeomDetUnit = tracker->idToDetUnit(recHitId);
        }
        const StripTopology *recHitTopology = dynamic_cast<const StripTopology*>(&(recHitGeomDetUnit->topology()));
        double iLength = recHitTopology->stripLength();
        LocalPoint temp_lpos = recHit->localPosition();
        LocalPoint temp_lpos_f(temp_lpos.x(),temp_lpos.y()+iLength/2.0,temp_lpos.z());
        LocalPoint temp_lpos_b(temp_lpos.x(),temp_lpos.y()-iLength/2.0,temp_lpos.z());
        GlobalPoint temp_gpos_f = recHitGeomDet->surface().toGlobal(temp_lpos_f);
        GlobalPoint temp_gpos_b = recHitGeomDet->surface().toGlobal(temp_lpos_b);
        GlobalVector fir_uvec((temp_gpos_f.x()-temp_gpos_b.x())/iLength,
                              (temp_gpos_f.y()-temp_gpos_b.y())/iLength,(temp_gpos_f.z()-temp_gpos_b.z())/iLength);
        DcxHit* try_me = new DcxHit(hit_global_pos.x(), hit_global_pos.y(), hit_global_pos.z(), 
                                    fir_uvec.x(), fir_uvec.y(), fir_uvec.z());
        listohits.push_back(try_me);
      }
    }
    DcxTrackCandidatesToTracks make_tracks(listohits,output, field);
  }//iterate over all track candidates

  edm::LogInfo("RoadSearch") << "Created " << output.size() << " tracks.";

}

Member Data Documentation

Definition at line 42 of file RoadSearchHelixMakerAlgorithm.h.