CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackSelector.cc
Go to the documentation of this file.
2 
3 using namespace reco;
4 
5 namespace helper
6 {
7 
8  TrackCollectionStoreManager::
9  TrackCollectionStoreManager(const edm::Handle<reco::TrackCollection> & )
10  :
11  selTracks_( new reco::TrackCollection ),
12  selTrackExtras_( new reco::TrackExtraCollection ),
13  selHits_( new TrackingRecHitCollection ),
14  selStripClusters_( new edmNew::DetSetVector<SiStripCluster> ),
15  selPixelClusters_( new edmNew::DetSetVector<SiPixelCluster> ),
16  rTracks_(), rTrackExtras_(), rHits_(),
17  clusterStorer_(),
18  idx_(0), hidx_(0),
19  cloneClusters_ (true)
20  {
21  }
22 
23 
24  //------------------------------------------------------------------
26  //------------------------------------------------------------------
27  void
29  processTrack( const Track & trk )
30  {
31  selTracks_->push_back( Track( trk ) );
32  selTracks_->back().setExtra( TrackExtraRef( rTrackExtras_, idx_ ++ ) );
33  selTrackExtras_->push_back( TrackExtra( trk.outerPosition(), trk.outerMomentum(), trk.outerOk(),
34  trk.innerPosition(), trk.innerMomentum(), trk.innerOk(),
35  trk.outerStateCovariance(), trk.outerDetId(),
36  trk.innerStateCovariance(), trk.innerDetId(),
37  trk.seedDirection() ) );
38  TrackExtra & tx = selTrackExtras_->back();
39  auto const firstHitIndex = hidx_;
40  unsigned int nHitsAdded = 0;
41  for( trackingRecHit_iterator hit = trk.recHitsBegin(); hit != trk.recHitsEnd();
42  ++ hit, ++ hidx_ ) {
43 
44  selHits_->push_back( (*hit)->clone() );
45  TrackingRecHit * newHit = & (selHits_->back());
46  ++nHitsAdded;
47 
48  //--- Skip the rest for this hit if we don't want to clone the cluster.
49  //--- The copy constructer in the rec hit will copy the link properly.
50  if (cloneClusters() && newHit->isValid()
51  && ((*hit)->geographicalId().det() == DetId::Tracker)) {
53  }
54  } // end of for loop over tracking rec hits on this track
55  tx.setHits( rHits_, firstHitIndex, nHitsAdded );
56 
57  } // end of track, and function
58 
59 
60  //------------------------------------------------------------------
62  //------------------------------------------------------------------
65  put( edm::Event & evt ) {
67  h = evt.put( selTracks_ );
68  evt.put( selTrackExtras_ );
69  evt.put( selHits_ );
70  evt.put( selStripClusters_ );
71  evt.put( selPixelClusters_ );
72  return h;
73  }
74 
75 } // end of namespace helper
76 
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:50
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:17
void addCluster(TrackingRecHitCollection &hits, size_t index)
add cluster of newHit to list (throws if hit is of unknown type)
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:75
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:94
void processTrack(const reco::Track &trk)
Process a single track.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
size_t hidx_
index to tracking rec hits
Definition: TrackSelector.h:87
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
reco::TrackExtraRefProd rTrackExtras_
Definition: TrackSelector.h:79
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:45
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:80
std::auto_ptr< reco::TrackCollection > selTracks_
Definition: TrackSelector.h:71
bool isValid() const
std::auto_ptr< reco::TrackExtraCollection > selTrackExtras_
Definition: TrackSelector.h:72
Pixel cluster – collection of neighboring pixels above threshold.
edm::OrphanHandle< reco::TrackCollection > put(edm::Event &evt)
Put tracks, track extras and hits+clusters into the event.
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
std::auto_ptr< TrackingRecHitCollection > selHits_
Definition: TrackSelector.h:73
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:204
std::auto_ptr< edmNew::DetSetVector< SiPixelCluster > > selPixelClusters_
Definition: TrackSelector.h:75
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:99
size_t idx_
index to track extra coll
Definition: TrackSelector.h:86
std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > selStripClusters_
Definition: TrackSelector.h:74
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109