CMS 3D CMS Logo

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::TrackCollectionput (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::unique_ptr< TrackingRecHitCollectionselHits_
 
std::unique_ptr< edmNew::DetSetVector< SiPixelCluster > > selPixelClusters_
 
std::unique_ptr< edmNew::DetSetVector< SiStripCluster > > selStripClusters_
 
std::unique_ptr< reco::TrackExtraCollectionselTrackExtras_
 
std::unique_ptr< reco::TrackCollectionselTracks_
 

Detailed Description

Class to manage copying of RecHits and Clusters from Tracks.

Definition at line 34 of file TrackSelector.h.

Member Typedef Documentation

◆ collection

typedef reco::TrackCollection helper::TrackCollectionStoreManager::collection

Definition at line 36 of file TrackSelector.h.

Constructor & Destructor Documentation

◆ TrackCollectionStoreManager()

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

Member Function Documentation

◆ cloneAndStore()

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 99 of file TrackSelector.h.

99  {
100  using namespace reco;
101 
102  rTracks_ = evt.template getRefBeforePut<TrackCollection>();
103  rTrackExtras_ = evt.template getRefBeforePut<TrackExtraCollection>();
104  rHits_ = evt.template getRefBeforePut<TrackingRecHitCollection>();
105  //--- New: save clusters too
107  evt.template getRefBeforePut<edmNew::DetSetVector<SiPixelCluster> >();
109  evt.template getRefBeforePut<edmNew::DetSetVector<SiStripCluster> >();
110 
111  //--- Indices into collections handled with RefProd
112  idx_ = 0;
113  hidx_ = 0;
115 
116  //--- Loop over tracks
117  for (I i = begin; i != end; ++i) {
118  //--- Whatever type the iterator i is, deref to reco::Track &
119  const reco::Track& trk = **i;
120  //--- Clone this track, and store references aside
121  processTrack(trk);
122  }
123  //--- Clone the clusters and fixup refs
124  clusterStorer_.processAllClusters(*selPixelClusters_, rPixelClusters, *selStripClusters_, rStripClusters);
125  }

References helper::ClusterStorer::clear(), clusterStorer_, mps_fire::end, hidx_, Exhume::I, mps_fire::i, idx_, helper::ClusterStorer::processAllClusters(), processTrack(), rHits_, rTrackExtras_, rTracks_, selPixelClusters_, and selStripClusters_.

◆ cloneClusters()

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 46 of file TrackSelector.h.

46 { return cloneClusters_; }

References cloneClusters_.

Referenced by processTrack().

◆ processTrack()

void helper::TrackCollectionStoreManager::processTrack ( const reco::Track trk)
private

Process a single track.

Definition at line 24 of file TrackSelector.cc.

24  {
25  selTracks_->push_back(Track(trk));
26  selTracks_->back().setExtra(TrackExtraRef(rTrackExtras_, idx_++));
27  selTrackExtras_->push_back(TrackExtra(trk.outerPosition(),
28  trk.outerMomentum(),
29  trk.outerOk(),
30  trk.innerPosition(),
31  trk.innerMomentum(),
32  trk.innerOk(),
34  trk.outerDetId(),
36  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(); ++hit, ++hidx_) {
42  selHits_->push_back((*hit)->clone());
43  TrackingRecHit* newHit = &(selHits_->back());
44  ++nHitsAdded;
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() && ((*hit)->geographicalId().det() == DetId::Tracker)) {
50  }
51  } // end of for loop over tracking rec hits on this track
52  tx.setHits(rHits_, firstHitIndex, nHitsAdded);
53 
54  } // end of track, and function

References 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_, reco::TrackExtraBase::setHits(), and DetId::Tracker.

Referenced by cloneAndStore().

◆ put()

edm::OrphanHandle< reco::TrackCollection > helper::TrackCollectionStoreManager::put ( edm::Event evt)

Put tracks, track extras and hits+clusters into the event.

Definition at line 59 of file TrackSelector.cc.

References h, eostools::move(), edm::Event::put(), selHits_, selPixelClusters_, selStripClusters_, selTrackExtras_, and selTracks_.

◆ setCloneClusters()

void helper::TrackCollectionStoreManager::setCloneClusters ( bool  w)
inline

Definition at line 47 of file TrackSelector.h.

47 { cloneClusters_ = w; }

References cloneClusters_, and w.

◆ size()

size_t helper::TrackCollectionStoreManager::size ( void  ) const
inline

Get the size.

Definition at line 57 of file TrackSelector.h.

57 { return selTracks_->size(); }

References selTracks_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

Member Data Documentation

◆ cloneClusters_

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_

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

◆ hidx_

size_t helper::TrackCollectionStoreManager::hidx_
private

index to tracking rec hits

Definition at line 85 of file TrackSelector.h.

Referenced by cloneAndStore(), and processTrack().

◆ idx_

size_t helper::TrackCollectionStoreManager::idx_
private

index to track extra coll

Definition at line 84 of file TrackSelector.h.

Referenced by cloneAndStore(), and processTrack().

◆ rHits_

TrackingRecHitRefProd helper::TrackCollectionStoreManager::rHits_
private

Definition at line 78 of file TrackSelector.h.

Referenced by cloneAndStore(), and processTrack().

◆ rTrackExtras_

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

Definition at line 77 of file TrackSelector.h.

Referenced by cloneAndStore(), and processTrack().

◆ rTracks_

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

Definition at line 76 of file TrackSelector.h.

Referenced by cloneAndStore().

◆ selHits_

std::unique_ptr<TrackingRecHitCollection> helper::TrackCollectionStoreManager::selHits_
private

Definition at line 71 of file TrackSelector.h.

Referenced by processTrack(), and put().

◆ selPixelClusters_

std::unique_ptr<edmNew::DetSetVector<SiPixelCluster> > helper::TrackCollectionStoreManager::selPixelClusters_
private

Definition at line 73 of file TrackSelector.h.

Referenced by cloneAndStore(), and put().

◆ selStripClusters_

std::unique_ptr<edmNew::DetSetVector<SiStripCluster> > helper::TrackCollectionStoreManager::selStripClusters_
private

Definition at line 72 of file TrackSelector.h.

Referenced by cloneAndStore(), and put().

◆ selTrackExtras_

std::unique_ptr<reco::TrackExtraCollection> helper::TrackCollectionStoreManager::selTrackExtras_
private

Definition at line 70 of file TrackSelector.h.

Referenced by processTrack(), and put().

◆ selTracks_

std::unique_ptr<reco::TrackCollection> helper::TrackCollectionStoreManager::selTracks_
private

Definition at line 69 of file TrackSelector.h.

Referenced by processTrack(), put(), and size().

reco::Track::outerPosition
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
reco::Track::outerMomentum
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:65
edm::RefProd
Definition: EDProductfwd.h:25
helper::TrackCollectionStoreManager::rTrackExtras_
reco::TrackExtraRefProd rTrackExtras_
Definition: TrackSelector.h:77
reco::Track::outerStateCovariance
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:68
reco::Track::outerDetId
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:79
mps_fire.i
i
Definition: mps_fire.py:428
reco::Track::recHitsBegin
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
helper::TrackCollectionStoreManager::selHits_
std::unique_ptr< TrackingRecHitCollection > selHits_
Definition: TrackSelector.h:71
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
helper::TrackCollectionStoreManager::selTrackExtras_
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
Definition: TrackSelector.h:70
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
reco::Track::outerOk
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:50
helper::TrackCollectionStoreManager::rHits_
TrackingRecHitRefProd rHits_
Definition: TrackSelector.h:78
reco::Track::innerStateCovariance
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:71
reco::Track::innerOk
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:53
reco::TrackExtra
Definition: TrackExtra.h:26
helper::TrackCollectionStoreManager::rTracks_
reco::TrackRefProd rTracks_
Definition: TrackSelector.h:76
reco::Track::innerMomentum
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:59
helper::TrackCollectionStoreManager::selStripClusters_
std::unique_ptr< edmNew::DetSetVector< SiStripCluster > > selStripClusters_
Definition: TrackSelector.h:72
h
Exhume::I
const std::complex< double > I
Definition: I.h:8
w
const double w
Definition: UKUtility.cc:23
reco::Track::recHitsEnd
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
mps_fire.end
end
Definition: mps_fire.py:242
reco::Track
Definition: Track.h:27
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
helper::ClusterStorer::addCluster
void addCluster(TrackingRecHitCollection &hits, size_t index)
add cluster of newHit to list (throws if hit is of unknown type)
Definition: ClusterStorer.cc:24
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
helper::TrackCollectionStoreManager::processTrack
void processTrack(const reco::Track &trk)
Process a single track.
Definition: TrackSelector.cc:24
reco::Track::seedDirection
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:148
DetId::Tracker
Definition: DetId.h:25
helper::TrackCollectionStoreManager::idx_
size_t idx_
index to track extra coll
Definition: TrackSelector.h:84
helper::TrackCollectionStoreManager::cloneClusters_
bool cloneClusters_
Clone clusters, or not? Default: true.
Definition: TrackSelector.h:88
reco::TrackExtraRef
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:16
reco::Track::innerPosition
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
reco::Track::innerDetId
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
helper::TrackCollectionStoreManager::hidx_
size_t hidx_
index to tracking rec hits
Definition: TrackSelector.h:85
helper::ClusterStorer::clear
void clear()
clear records
Definition: ClusterStorer.cc:71
reco::TrackExtraBase::setHits
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
Definition: TrackExtraBase.h:30
TrackingRecHit
Definition: TrackingRecHit.h:21
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle< reco::TrackCollection >
helper::TrackCollectionStoreManager::selTracks_
std::unique_ptr< reco::TrackCollection > selTracks_
Definition: TrackSelector.h:69
helper::TrackCollectionStoreManager::clusterStorer_
ClusterStorer clusterStorer_
Definition: TrackSelector.h:81
helper::TrackCollectionStoreManager::cloneClusters
bool cloneClusters()
Definition: TrackSelector.h:46
helper::TrackCollectionStoreManager::selPixelClusters_
std::unique_ptr< edmNew::DetSetVector< SiPixelCluster > > selPixelClusters_
Definition: TrackSelector.h:73
TrackingRecHit::isValid
bool isValid() const
Definition: TrackingRecHit.h:141
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >
helper::ClusterStorer::processAllClusters
void processAllClusters(edmNew::DetSetVector< SiPixelCluster > &pixelDsvToFill, edm::RefProd< edmNew::DetSetVector< SiPixelCluster > > refPixelClusters, edmNew::DetSetVector< SiStripCluster > &stripDsvToFill, edm::RefProd< edmNew::DetSetVector< SiStripCluster > > refStripClusters)
Definition: ClusterStorer.cc:77