CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFDisplacedTrackerVertexProducer Class Reference

#include <PFDisplacedTrackerVertexProducer.h>

Inheritance diagram for PFDisplacedTrackerVertexProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFDisplacedTrackerVertexProducer (const edm::ParameterSet &)
 Constructor. More...
 
 ~PFDisplacedTrackerVertexProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 Produce the PFRecTrack collection. More...
 

Private Attributes

edm::EDGetTokenT< reco::PFDisplacedVertexCollectionpfDisplacedVertexContainer_
 
edm::EDGetTokenT< reco::TrackCollectionpfTrackContainer_
 
PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file PFDisplacedTrackerVertexProducer.h.

Constructor & Destructor Documentation

PFDisplacedTrackerVertexProducer::PFDisplacedTrackerVertexProducer ( const edm::ParameterSet iConfig)
explicit

Constructor.

Definition at line 10 of file PFDisplacedTrackerVertexProducer.cc.

References edm::ParameterSet::getParameter(), pfDisplacedVertexContainer_, and pfTrackContainer_.

10  :
11  pfTransformer_(nullptr)
12 {
13  produces<reco::PFRecTrackCollection>();
14  produces<reco::PFDisplacedTrackerVertexCollection>();
15 
16  pfDisplacedVertexContainer_ = consumes<reco::PFDisplacedVertexCollection>( iConfig.getParameter< InputTag >("displacedTrackerVertexColl"));
17 
18 
19  pfTrackContainer_ =consumes<reco::TrackCollection>(
20  iConfig.getParameter< InputTag >("trackColl"));
21 
22 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > pfTrackContainer_
edm::EDGetTokenT< reco::PFDisplacedVertexCollection > pfDisplacedVertexContainer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
PFDisplacedTrackerVertexProducer::~PFDisplacedTrackerVertexProducer ( )
override

Destructor.

Definition at line 24 of file PFDisplacedTrackerVertexProducer.cc.

References pfTransformer_.

25 {
26  delete pfTransformer_;
27 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

Member Function Documentation

void PFDisplacedTrackerVertexProducer::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate
void PFDisplacedTrackerVertexProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 109 of file PFDisplacedTrackerVertexProducer.cc.

References pfTransformer_.

110  {
111  delete pfTransformer_;
112  pfTransformer_=nullptr;
113 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
void PFDisplacedTrackerVertexProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Produce the PFRecTrack collection.

Definition at line 30 of file PFDisplacedTrackerVertexProducer.cc.

References PFTrackTransformer::addPoints(), reco::TrackBase::charge(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), icoll, training_settings::idx, edm::RefToBase< T >::key(), reco::PFRecTrack::KF, eostools::move(), pfDisplacedVertexContainer_, pfTrackContainer_, pfTransformer_, edm::RefVector< C, T, F >::push_back(), edm::Event::put(), and pfDisplacedTrackerVertex_cfi::trackColl.

31 {
32 
33  //create the empty collections
34  auto pfDisplacedTrackerVertexColl = std::make_unique<reco::PFDisplacedTrackerVertexCollection>();
35  auto pfRecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
36 
38 
39 
40 
42  iEvent.getByToken(pfDisplacedVertexContainer_, nuclCollH);
43  const reco::PFDisplacedVertexCollection& nuclColl = *(nuclCollH.product());
44 
46  iEvent.getByToken(pfTrackContainer_, trackColl);
47 
48  int idx = 0;
49 
50  // cout << "Size of Displaced Vertices "
51  // << nuclColl.size() << endl;
52 
53  // loop on all NuclearInteraction
54  for( unsigned int icoll=0; icoll < nuclColl.size(); icoll++) {
55 
56  reco::PFRecTrackRefVector pfRecTkcoll;
57 
58  std::vector<reco::Track> refittedTracks = nuclColl[icoll].refittedTracks();
59 
60  // convert the secondary tracks
61  for(unsigned it = 0; it < refittedTracks.size(); it++){
62 
63  reco::TrackBaseRef trackBaseRef = nuclColl[icoll].originalTrack(refittedTracks[it]);
64 
65  // cout << "track base pt = " << trackBaseRef->pt() << endl;
66 
67  reco::TrackRef trackRef(trackColl, trackBaseRef.key());
68 
69  // cout << "track pt = " << trackRef->pt() << endl;
70 
71 
72  reco::PFRecTrack pfRecTrack( trackBaseRef->charge(),
74  trackBaseRef.key(),
75  trackRef );
76 
77  // cout << pfRecTrack << endl;
78 
79  Trajectory FakeTraj;
80  bool valid = pfTransformer_->addPoints( pfRecTrack, *trackBaseRef, FakeTraj);
81  if(valid) {
82  pfRecTkcoll.push_back(reco::PFRecTrackRef( pfTrackRefProd, idx++));
83  pfRecTrackColl->push_back(pfRecTrack);
84  // cout << "after "<< pfRecTrack << endl;
85 
86  }
87  }
88  reco::PFDisplacedVertexRef niRef(nuclCollH, icoll);
89  pfDisplacedTrackerVertexColl->push_back( reco::PFDisplacedTrackerVertex( niRef, pfRecTkcoll ));
90  }
91 
92  iEvent.put(std::move(pfRecTrackColl));
93  iEvent.put(std::move(pfDisplacedTrackerVertexColl));
94 }
edm::EDGetTokenT< reco::TrackCollection > pfTrackContainer_
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
std::vector< PFDisplacedVertex > PFDisplacedVertexCollection
collection of PFDisplacedVertex objects
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
bool addPoints(reco::PFRecTrack &pftrack, const reco::Track &track, const Trajectory &traj, bool msgwarning=true) const
Add points to a PFTrack. return false if a TSOS is invalid.
edm::EDGetTokenT< reco::PFDisplacedVertexCollection > pfDisplacedVertexContainer_
size_t key() const
Definition: RefToBase.h:250
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
RefProd< PROD > getRefBeforePut()
Definition: Event.h:147
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:69
int charge() const
track electric charge
Definition: TrackBase.h:567
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
def move(src, dest)
Definition: eostools.py:510
int icoll
Definition: AMPTWrapper.h:136

Member Data Documentation

edm::EDGetTokenT<reco::PFDisplacedVertexCollection> PFDisplacedTrackerVertexProducer::pfDisplacedVertexContainer_
private

Definition at line 30 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().

edm::EDGetTokenT<reco::TrackCollection> PFDisplacedTrackerVertexProducer::pfTrackContainer_
private

Definition at line 31 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().

PFTrackTransformer* PFDisplacedTrackerVertexProducer::pfTransformer_
private