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 Member Functions | Private Attributes
helper::TrackCollectionStoreManager Struct Reference

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. More...
 
bool cloneClusters ()
 
edm::OrphanHandle
< reco::TrackCollection
put (edm::Event &evt)
 Put tracks, track extras and hits+clusters into the event. More...
 
void setCloneClusters (bool w)
 
size_t size () const
 Get the size. More...
 
 TrackCollectionStoreManager (const edm::Handle< reco::TrackCollection > &)
 

Private Member Functions

void processTrack (const reco::Track &trk)
 Process a single track. More...
 

Private Attributes

bool cloneClusters_
 Clone clusters, or not? Default: true. More...
 
ClusterStorer clusterStorer_
 
size_t hidx_
 index to tracking rec hits More...
 
size_t idx_
 index to track extra coll More...
 
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_
 

Detailed Description

Class to manage copying of RecHits and Clusters from Tracks.

Definition at line 33 of file TrackSelector.h.

Member Typedef Documentation

Definition at line 35 of file TrackSelector.h.

Constructor & Destructor Documentation

helper::TrackCollectionStoreManager::TrackCollectionStoreManager ( const edm::Handle< reco::TrackCollection > &  )

Definition at line 9 of file TrackSelector.cc.

10  :
18  idx_(0), hidx_(0),
19  cloneClusters_ (true)
20  {
21  }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
bool cloneClusters_
Clone clusters, or not? Default: true.
Definition: TrackSelector.h:88
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
size_t hidx_
index to tracking rec hits
Definition: TrackSelector.h:85
reco::TrackExtraRefProd rTrackExtras_
Definition: TrackSelector.h:77
std::auto_ptr< reco::TrackCollection > selTracks_
Definition: TrackSelector.h:69
std::auto_ptr< reco::TrackExtraCollection > selTrackExtras_
Definition: TrackSelector.h:70
std::auto_ptr< TrackingRecHitCollection > selHits_
Definition: TrackSelector.h:71
std::auto_ptr< edmNew::DetSetVector< SiPixelCluster > > selPixelClusters_
Definition: TrackSelector.h:73
size_t idx_
index to track extra coll
Definition: TrackSelector.h:84
std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > selStripClusters_
Definition: TrackSelector.h:72

Member Function Documentation

template<typename I >
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(), L1Trigger_dataformats::reco, rHits_, rTrackExtras_, rTracks_, selPixelClusters_, and selStripClusters_.

102  {
103  using namespace reco;
104 
105  rTracks_ = evt.template getRefBeforePut<TrackCollection>();
106  rTrackExtras_ = evt.template getRefBeforePut<TrackExtraCollection>();
107  rHits_ = evt.template getRefBeforePut<TrackingRecHitCollection>();
108  //--- New: save clusters too
110  = evt.template getRefBeforePut<edmNew::DetSetVector<SiPixelCluster> >();
112  = evt.template getRefBeforePut<edmNew::DetSetVector<SiStripCluster> >();
113 
114  //--- Indices into collections handled with RefProd
115  idx_ = 0;
116  hidx_ = 0;
118 
119  //--- Loop over tracks
120  for( I i = begin; i != end; ++ i ) {
121  //--- Whatever type the iterator i is, deref to reco::Track &
122  const reco::Track & trk = * * i;
123  //--- Clone this track, and store references aside
124  processTrack( trk );
125  }
126  //--- Clone the clusters and fixup refs
128  *selStripClusters_, rStripClusters);
129  }
int i
Definition: DBlmapReader.cc:9
void processTrack(const reco::Track &trk)
Process a single track.
const std::complex< double > I
Definition: I.h:8
#define end
Definition: vmac.h:38
size_t hidx_
index to tracking rec hits
Definition: TrackSelector.h:85
reco::TrackExtraRefProd rTrackExtras_
Definition: TrackSelector.h:77
void clear()
clear records
#define begin
Definition: vmac.h:31
void processAllClusters(edmNew::DetSetVector< SiPixelCluster > &pixelDsvToFill, edm::RefProd< edmNew::DetSetVector< SiPixelCluster > > refPixelClusters, edmNew::DetSetVector< SiStripCluster > &stripDsvToFill, edm::RefProd< edmNew::DetSetVector< SiStripCluster > > refStripClusters)
std::auto_ptr< edmNew::DetSetVector< SiPixelCluster > > selPixelClusters_
Definition: TrackSelector.h:73
size_t idx_
index to track extra coll
Definition: TrackSelector.h:84
std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > selStripClusters_
Definition: TrackSelector.h:72
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().

45 {return cloneClusters_ ; }
bool cloneClusters_
Clone clusters, or not? Default: true.
Definition: TrackSelector.h:88
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 DetId::Tracker.

Referenced by cloneAndStore().

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  for( trackingRecHit_iterator hit = trk.recHitsBegin(); hit != trk.recHitsEnd();
40  ++ hit, ++ hidx_ ) {
41 
42  selHits_->push_back( (*hit)->clone() );
43  TrackingRecHit * newHit = & (selHits_->back());
45 
46  //--- Skip the rest for this hit if we don't want to clone the cluster.
47  //--- The copy constructer in the rec hit will copy the link properly.
48  if (cloneClusters() && newHit->isValid()
49  && ((*hit)->geographicalId().det() == DetId::Tracker)) {
51  }
52  } // end of for loop over tracking rec hits on this track
53  } // end of track, and function
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:40
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:13
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:47
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:42
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:51
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:59
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:63
size_t hidx_
index to tracking rec hits
Definition: TrackSelector.h:85
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:49
reco::TrackExtraRefProd rTrackExtras_
Definition: TrackSelector.h:77
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:38
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:53
std::auto_ptr< reco::TrackCollection > selTracks_
Definition: TrackSelector.h:69
bool isValid() const
std::auto_ptr< reco::TrackExtraCollection > selTrackExtras_
Definition: TrackSelector.h:70
void add(const TrackingRecHitRef &r)
add a reference to a RecHit
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:45
std::auto_ptr< TrackingRecHitCollection > selHits_
Definition: TrackSelector.h:71
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:105
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:61
size_t idx_
index to track extra coll
Definition: TrackSelector.h:84
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:65
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_.

61  {
63  h = evt.put( selTracks_ );
64  evt.put( selTrackExtras_ );
65  evt.put( selHits_ );
66  evt.put( selStripClusters_ );
67  evt.put( selPixelClusters_ );
68  return h;
69  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::auto_ptr< reco::TrackCollection > selTracks_
Definition: TrackSelector.h:69
std::auto_ptr< reco::TrackExtraCollection > selTrackExtras_
Definition: TrackSelector.h:70
std::auto_ptr< TrackingRecHitCollection > selHits_
Definition: TrackSelector.h:71
std::auto_ptr< edmNew::DetSetVector< SiPixelCluster > > selPixelClusters_
Definition: TrackSelector.h:73
std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > selStripClusters_
Definition: TrackSelector.h:72
void helper::TrackCollectionStoreManager::setCloneClusters ( bool  w)
inline

Definition at line 46 of file TrackSelector.h.

References cloneClusters_, and w().

46 { cloneClusters_ = w; }
bool cloneClusters_
Clone clusters, or not? Default: true.
Definition: TrackSelector.h:88
T w() const
size_t helper::TrackCollectionStoreManager::size ( void  ) const
inline

Get the size.

Definition at line 56 of file TrackSelector.h.

References selTracks_.

56 { return selTracks_->size(); }
std::auto_ptr< reco::TrackCollection > selTracks_
Definition: TrackSelector.h:69

Member Data Documentation

bool helper::TrackCollectionStoreManager::cloneClusters_
private

Clone clusters, or not? Default: true.

Definition at line 88 of file TrackSelector.h.

Referenced by cloneClusters(), and setCloneClusters().

ClusterStorer helper::TrackCollectionStoreManager::clusterStorer_
private

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().

TrackingRecHitRefProd helper::TrackCollectionStoreManager::rHits_
private

Definition at line 78 of file TrackSelector.h.

Referenced by cloneAndStore(), and processTrack().

reco::TrackExtraRefProd helper::TrackCollectionStoreManager::rTrackExtras_
private

Definition at line 77 of file TrackSelector.h.

Referenced by cloneAndStore(), and processTrack().

reco::TrackRefProd helper::TrackCollectionStoreManager::rTracks_
private

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().