CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
helper::GsfElectronCollectionStoreManager Struct Reference

#include <GsfElectronSelector.h>

Public Types

typedef reco::GsfElectronCollection collection
 

Public Member Functions

template<typename I >
void cloneAndStore (const I &begin, const I &end, edm::Event &evt)
 
 GsfElectronCollectionStoreManager (const edm::Handle< reco::GsfElectronCollection > &)
 
edm::OrphanHandle< reco::GsfElectronCollectionput (edm::Event &evt)
 
size_t size () const
 

Private Attributes

std::unique_ptr< reco::GsfElectronCoreCollectionselElectronCores_
 
std::unique_ptr< reco::GsfElectronCollectionselElectrons_
 
std::unique_ptr< reco::GsfTrackExtraCollectionselGsfTrackExtras_
 
std::unique_ptr< TrackingRecHitCollectionselHits_
 
std::unique_ptr< reco::SuperClusterCollectionselSuperClusters_
 
std::unique_ptr< reco::TrackExtraCollectionselTrackExtras_
 
std::unique_ptr< reco::GsfTrackCollectionselTracks_
 

Detailed Description

Definition at line 25 of file GsfElectronSelector.h.

Member Typedef Documentation

◆ collection

typedef reco::GsfElectronCollection helper::GsfElectronCollectionStoreManager::collection

Definition at line 26 of file GsfElectronSelector.h.

Constructor & Destructor Documentation

◆ GsfElectronCollectionStoreManager()

helper::GsfElectronCollectionStoreManager::GsfElectronCollectionStoreManager ( const edm::Handle< reco::GsfElectronCollection > &  )
inline

Definition at line 27 of file GsfElectronSelector.h.

std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
std::unique_ptr< reco::GsfTrackCollection > selTracks_
std::unique_ptr< reco::GsfElectronCollection > selElectrons_
std::unique_ptr< TrackingRecHitCollection > selHits_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::vector< GsfElectronCore > GsfElectronCoreCollection
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
std::unique_ptr< reco::SuperClusterCollection > selSuperClusters_
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
std::unique_ptr< reco::GsfTrackExtraCollection > selGsfTrackExtras_
std::unique_ptr< reco::GsfElectronCoreCollection > selElectronCores_

Member Function Documentation

◆ cloneAndStore()

template<typename I >
void helper::GsfElectronCollectionStoreManager::cloneAndStore ( const I &  begin,
const I &  end,
edm::Event evt 
)
inline

Definition at line 36 of file GsfElectronSelector.h.

References cms::cuda::assert(), reco::GsfElectron::core(), reco::GsfElectron::gsfTrack(), Exhume::I, mps_fire::i, heavyIonCSV_trainingSettings::idx, edm::Ref< C, T, F >::isNonnull(), reco::TrackExtraBase::recHitsSize(), selElectronCores_, selElectrons_, selGsfTrackExtras_, selHits_, selSuperClusters_, selTrackExtras_, selTracks_, reco::TrackExtraBase::setHits(), reco::TrackExtraBase::setTrajParams(), reco::GsfElectron::superCluster(), reco::TrackExtraBase::trajParams(), and trk.

36  {
37  using namespace reco;
38  TrackingRecHitRefProd rHits = evt.template getRefBeforePut<TrackingRecHitCollection>();
39  TrackExtraRefProd rTrackExtras = evt.template getRefBeforePut<TrackExtraCollection>();
40  GsfTrackExtraRefProd rGsfTrackExtras = evt.template getRefBeforePut<GsfTrackExtraCollection>();
41  GsfTrackRefProd rTracks = evt.template getRefBeforePut<GsfTrackCollection>();
42  GsfElectronCoreRefProd rElectronCores = evt.template getRefBeforePut<GsfElectronCoreCollection>();
43  GsfElectronRefProd rElectrons = evt.template getRefBeforePut<GsfElectronCollection>();
44  SuperClusterRefProd rSuperClusters = evt.template getRefBeforePut<SuperClusterCollection>();
45  size_t idx = 0, tidx = 0, hidx = 0;
46  for (I i = begin; i != end; ++i) {
47  const GsfElectron& ele = **i;
48  selElectronCores_->push_back(GsfElectronCore(*(ele.core())));
49  selElectronCores_->back().setGsfTrack(GsfTrackRef(rTracks, idx));
50  selElectronCores_->back().setSuperCluster(SuperClusterRef(rSuperClusters, idx));
51  selSuperClusters_->push_back(SuperCluster(*(ele.superCluster())));
52  selElectrons_->push_back(GsfElectron(ele,
53  GsfElectronCoreRef(rElectronCores, idx++),
55  TrackRef(),
56  TrackBaseRef(),
58  GsfTrackRef trkRef = ele.gsfTrack();
59  if (trkRef.isNonnull()) {
60  selTracks_->push_back(GsfTrack(*trkRef));
61  GsfTrack& trk = selTracks_->back();
62  selTrackExtras_->push_back(TrackExtra(trk.outerPosition(),
63  trk.outerMomentum(),
64  trk.outerOk(),
65  trk.innerPosition(),
66  trk.innerMomentum(),
67  trk.innerOk(),
68  trk.outerStateCovariance(),
69  trk.outerDetId(),
70  trk.innerStateCovariance(),
71  trk.innerDetId(),
72  trk.seedDirection()));
73  selGsfTrackExtras_->push_back(GsfTrackExtra(*(trk.gsfExtra())));
74  TrackExtra& tx = selTrackExtras_->back();
75  unsigned int nHitsToAdd = trk.recHitsSize();
76  for (auto const& hit : trk.recHits())
77  selHits_->push_back(hit->clone());
78  tx.setHits(rHits, hidx, nHitsToAdd);
79  tx.setTrajParams(trk.extra()->trajParams(), trk.extra()->chi2sX5());
80  assert(tx.trajParams().size() == tx.recHitsSize());
81  hidx += nHitsToAdd;
82  trk.setGsfExtra(GsfTrackExtraRef(rGsfTrackExtras, tidx));
83  trk.setExtra(TrackExtraRef(rTrackExtras, tidx++));
84  }
85  }
86  }
edm::Ref< GsfTrackCollection > GsfTrackRef
persistent reference to a GsfTrack
Definition: GsfTrackFwd.h:13
edm::Ref< GsfElectronCoreCollection > GsfElectronCoreRef
TrajParams const & trajParams() const
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
unsigned int recHitsSize() const
number of RecHits
Trktree trk
Definition: Trktree.cc:2
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
std::unique_ptr< reco::GsfTrackCollection > selTracks_
std::unique_ptr< reco::GsfElectronCollection > selElectrons_
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:16
edm::Ptr< CaloCluster > CaloClusterPtr
std::unique_ptr< TrackingRecHitCollection > selHits_
assert(be >=bs)
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:35
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
const std::complex< double > I
Definition: I.h:8
edm::RefVector< GsfTrackCollection > GsfTrackRefVector
vector of reference to GsfTrack in the same collection
Definition: GsfTrackFwd.h:17
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
std::unique_ptr< reco::SuperClusterCollection > selSuperClusters_
edm::Ref< GsfTrackExtraCollection > GsfTrackExtraRef
persistent reference to a GsfTrackExtra
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
std::unique_ptr< reco::GsfTrackExtraCollection > selGsfTrackExtras_
std::unique_ptr< reco::GsfElectronCoreCollection > selElectronCores_
fixed size matrix
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
void setTrajParams(TrajParams tmps, Chi2sFive chi2s)

◆ put()

edm::OrphanHandle<reco::GsfElectronCollection> helper::GsfElectronCollectionStoreManager::put ( edm::Event evt)
inline

Definition at line 88 of file GsfElectronSelector.h.

References h, eostools::move(), edm::Event::put(), selElectronCores_, selElectrons_, selGsfTrackExtras_, selHits_, selSuperClusters_, selTrackExtras_, and selTracks_.

88  {
92  evt.put(std::move(selTracks_));
95  evt.put(std::move(selHits_));
96  return h;
97  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::unique_ptr< reco::GsfTrackCollection > selTracks_
std::unique_ptr< reco::GsfElectronCollection > selElectrons_
std::unique_ptr< TrackingRecHitCollection > selHits_
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
std::unique_ptr< reco::SuperClusterCollection > selSuperClusters_
std::unique_ptr< reco::GsfTrackExtraCollection > selGsfTrackExtras_
std::unique_ptr< reco::GsfElectronCoreCollection > selElectronCores_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
def move(src, dest)
Definition: eostools.py:511

◆ size()

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

Definition at line 99 of file GsfElectronSelector.h.

References selElectrons_.

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

99 { return selElectrons_->size(); }
std::unique_ptr< reco::GsfElectronCollection > selElectrons_

Member Data Documentation

◆ selElectronCores_

std::unique_ptr<reco::GsfElectronCoreCollection> helper::GsfElectronCollectionStoreManager::selElectronCores_
private

Definition at line 103 of file GsfElectronSelector.h.

Referenced by cloneAndStore(), and put().

◆ selElectrons_

std::unique_ptr<reco::GsfElectronCollection> helper::GsfElectronCollectionStoreManager::selElectrons_
private

Definition at line 102 of file GsfElectronSelector.h.

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

◆ selGsfTrackExtras_

std::unique_ptr<reco::GsfTrackExtraCollection> helper::GsfElectronCollectionStoreManager::selGsfTrackExtras_
private

Definition at line 107 of file GsfElectronSelector.h.

Referenced by cloneAndStore(), and put().

◆ selHits_

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

Definition at line 108 of file GsfElectronSelector.h.

Referenced by cloneAndStore(), and put().

◆ selSuperClusters_

std::unique_ptr<reco::SuperClusterCollection> helper::GsfElectronCollectionStoreManager::selSuperClusters_
private

Definition at line 104 of file GsfElectronSelector.h.

Referenced by cloneAndStore(), and put().

◆ selTrackExtras_

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

Definition at line 106 of file GsfElectronSelector.h.

Referenced by cloneAndStore(), and put().

◆ selTracks_

std::unique_ptr<reco::GsfTrackCollection> helper::GsfElectronCollectionStoreManager::selTracks_
private

Definition at line 105 of file GsfElectronSelector.h.

Referenced by cloneAndStore(), and put().