Class to manage copying of RecHits and Clusters from Tracks. More...
#include <TrackSelector.h>
Public Types | |
typedef reco::TrackCollection | collection |
Public Member Functions | |
template<typename I > | |
void | cloneAndStore (const I &begin, const I &end, edm::Event &evt) |
Method to clone tracks, track extras and their hits and clusters. typename I = this is an interator over a track collection, **I needs to dereference into a Track. | |
bool | cloneClusters () |
edm::OrphanHandle < reco::TrackCollection > | put (edm::Event &evt) |
Put tracks, track extras and hits+clusters into the event. | |
void | setCloneClusters (bool w) |
size_t | size () const |
Get the size. | |
TrackCollectionStoreManager (const edm::Handle< reco::TrackCollection > &) | |
Private Member Functions | |
void | processTrack (const reco::Track &trk) |
Process a single track. | |
Private Attributes | |
bool | cloneClusters_ |
Clone clusters, or not? Default: true. | |
ClusterStorer | clusterStorer_ |
size_t | hidx_ |
index to tracking rec hits | |
size_t | idx_ |
index to track extra coll | |
TrackingRecHitRefProd | rHits_ |
reco::TrackExtraRefProd | rTrackExtras_ |
reco::TrackRefProd | rTracks_ |
std::auto_ptr < TrackingRecHitCollection > | selHits_ |
std::auto_ptr < edmNew::DetSetVector < SiPixelCluster > > | selPixelClusters_ |
std::auto_ptr < edmNew::DetSetVector < SiStripCluster > > | selStripClusters_ |
std::auto_ptr < reco::TrackExtraCollection > | selTrackExtras_ |
std::auto_ptr < reco::TrackCollection > | selTracks_ |
Class to manage copying of RecHits and Clusters from Tracks.
Definition at line 33 of file TrackSelector.h.
Definition at line 35 of file TrackSelector.h.
helper::TrackCollectionStoreManager::TrackCollectionStoreManager | ( | const edm::Handle< reco::TrackCollection > & | ) |
Definition at line 9 of file TrackSelector.cc.
: selTracks_( new reco::TrackCollection ), selTrackExtras_( new reco::TrackExtraCollection ), selHits_( new TrackingRecHitCollection ), selStripClusters_( new edmNew::DetSetVector<SiStripCluster> ), selPixelClusters_( new edmNew::DetSetVector<SiPixelCluster> ), rTracks_(), rTrackExtras_(), rHits_(), clusterStorer_(), idx_(0), hidx_(0), cloneClusters_ (true) { }
void helper::TrackCollectionStoreManager::cloneAndStore | ( | const I & | begin, |
const I & | end, | ||
edm::Event & | evt | ||
) |
Method to clone tracks, track extras and their hits and clusters. typename I = this is an interator over a track collection, **I needs to dereference into a Track.
< index to track extra coll
< index to tracking rec hits
Definition at line 101 of file TrackSelector.h.
References helper::ClusterStorer::clear(), clusterStorer_, end, hidx_, Exhume::I, i, idx_, helper::ClusterStorer::processAllClusters(), processTrack(), dt_offlineAnalysis_common_cff::reco, rHits_, rTrackExtras_, rTracks_, selPixelClusters_, and selStripClusters_.
{ using namespace reco; rTracks_ = evt.template getRefBeforePut<TrackCollection>(); rTrackExtras_ = evt.template getRefBeforePut<TrackExtraCollection>(); rHits_ = evt.template getRefBeforePut<TrackingRecHitCollection>(); //--- New: save clusters too edm::RefProd<edmNew::DetSetVector<SiPixelCluster> > rPixelClusters = evt.template getRefBeforePut<edmNew::DetSetVector<SiPixelCluster> >(); edm::RefProd<edmNew::DetSetVector<SiStripCluster> > rStripClusters = evt.template getRefBeforePut<edmNew::DetSetVector<SiStripCluster> >(); //--- Indices into collections handled with RefProd idx_ = 0; hidx_ = 0; clusterStorer_.clear(); //--- Loop over tracks for( I i = begin; i != end; ++ i ) { //--- Whatever type the iterator i is, deref to reco::Track & const reco::Track & trk = * * i; //--- Clone this track, and store references aside processTrack( trk ); } //--- Clone the clusters and fixup refs clusterStorer_.processAllClusters(*selPixelClusters_, rPixelClusters, *selStripClusters_, rStripClusters); }
bool helper::TrackCollectionStoreManager::cloneClusters | ( | ) | [inline] |
Use these to turn off/on the cloning of clusters. The default is to clone them. To not clone (and save space in a quick local job, do: setCloneClusters(false);
Definition at line 45 of file TrackSelector.h.
References cloneClusters_.
Referenced by processTrack().
{return cloneClusters_ ; }
void helper::TrackCollectionStoreManager::processTrack | ( | const reco::Track & | trk | ) | [private] |
Process a single track.
Definition at line 29 of file TrackSelector.cc.
References reco::TrackExtraBase::add(), helper::ClusterStorer::addCluster(), cloneClusters(), clusterStorer_, hidx_, idx_, reco::Track::innerDetId(), reco::Track::innerMomentum(), reco::Track::innerOk(), reco::Track::innerPosition(), reco::Track::innerStateCovariance(), TrackingRecHit::isValid(), reco::Track::outerDetId(), reco::Track::outerMomentum(), reco::Track::outerOk(), reco::Track::outerPosition(), reco::Track::outerStateCovariance(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), rHits_, rTrackExtras_, reco::Track::seedDirection(), selHits_, selTrackExtras_, selTracks_, and align::Tracker.
Referenced by cloneAndStore().
{ selTracks_->push_back( Track( trk ) ); selTracks_->back().setExtra( TrackExtraRef( rTrackExtras_, idx_ ++ ) ); selTrackExtras_->push_back( TrackExtra( trk.outerPosition(), trk.outerMomentum(), trk.outerOk(), trk.innerPosition(), trk.innerMomentum(), trk.innerOk(), trk.outerStateCovariance(), trk.outerDetId(), trk.innerStateCovariance(), trk.innerDetId(), trk.seedDirection() ) ); TrackExtra & tx = selTrackExtras_->back(); for( trackingRecHit_iterator hit = trk.recHitsBegin(); hit != trk.recHitsEnd(); ++ hit, ++ hidx_ ) { selHits_->push_back( (*hit)->clone() ); TrackingRecHit * newHit = & (selHits_->back()); tx.add( TrackingRecHitRef( rHits_, hidx_ ) ); //--- Skip the rest for this hit if we don't want to clone the cluster. //--- The copy constructer in the rec hit will copy the link properly. if (cloneClusters() && newHit->isValid() && ((*hit)->geographicalId().det() == DetId::Tracker)) { clusterStorer_.addCluster( *selHits_, hidx_ ); } } // end of for loop over tracking rec hits on this track } // end of track, and function
edm::OrphanHandle< reco::TrackCollection > helper::TrackCollectionStoreManager::put | ( | edm::Event & | evt | ) |
Put tracks, track extras and hits+clusters into the event.
Definition at line 61 of file TrackSelector.cc.
References h, edm::Event::put(), selHits_, selPixelClusters_, selStripClusters_, selTrackExtras_, and selTracks_.
{ edm::OrphanHandle<reco::TrackCollection> h = evt.put( selTracks_ ); evt.put( selTrackExtras_ ); evt.put( selHits_ ); evt.put( selStripClusters_ ); evt.put( selPixelClusters_ ); return h; }
void helper::TrackCollectionStoreManager::setCloneClusters | ( | bool | w | ) | [inline] |
size_t helper::TrackCollectionStoreManager::size | ( | void | ) | const [inline] |
Get the size.
Definition at line 56 of file TrackSelector.h.
References selTracks_.
{ return selTracks_->size(); }
bool helper::TrackCollectionStoreManager::cloneClusters_ [private] |
Clone clusters, or not? Default: true.
Definition at line 88 of file TrackSelector.h.
Referenced by cloneClusters(), and setCloneClusters().
Helper to treat copies of selected clusters and make the hits refer to the output cluster collections:
Definition at line 81 of file TrackSelector.h.
Referenced by cloneAndStore(), and processTrack().
size_t helper::TrackCollectionStoreManager::hidx_ [private] |
index to tracking rec hits
Definition at line 85 of file TrackSelector.h.
Referenced by cloneAndStore(), and processTrack().
size_t helper::TrackCollectionStoreManager::idx_ [private] |
index to track extra coll
Definition at line 84 of file TrackSelector.h.
Referenced by cloneAndStore(), and processTrack().
Definition at line 78 of file TrackSelector.h.
Referenced by cloneAndStore(), and processTrack().
Definition at line 77 of file TrackSelector.h.
Referenced by cloneAndStore(), and processTrack().
Definition at line 76 of file TrackSelector.h.
Referenced by cloneAndStore().
std::auto_ptr<TrackingRecHitCollection> helper::TrackCollectionStoreManager::selHits_ [private] |
Definition at line 71 of file TrackSelector.h.
Referenced by processTrack(), and put().
std::auto_ptr< edmNew::DetSetVector<SiPixelCluster> > helper::TrackCollectionStoreManager::selPixelClusters_ [private] |
Definition at line 73 of file TrackSelector.h.
Referenced by cloneAndStore(), and put().
std::auto_ptr< edmNew::DetSetVector<SiStripCluster> > helper::TrackCollectionStoreManager::selStripClusters_ [private] |
Definition at line 72 of file TrackSelector.h.
Referenced by cloneAndStore(), and put().
std::auto_ptr<reco::TrackExtraCollection> helper::TrackCollectionStoreManager::selTrackExtras_ [private] |
Definition at line 70 of file TrackSelector.h.
Referenced by processTrack(), and put().
std::auto_ptr<reco::TrackCollection> helper::TrackCollectionStoreManager::selTracks_ [private] |
Definition at line 69 of file TrackSelector.h.
Referenced by processTrack(), put(), and size().