CMS 3D CMS Logo

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

#include <ConversionTrackProducer.h>

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

Public Member Functions

 ConversionTrackProducer (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~ConversionTrackProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 Types

typedef edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::GsfTrackCollection, unsigned short > > TrajGsfTrackAssociationCollection
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotInputTag
 
edm::ParameterSet conf_
 
IdealHelixParameters ConvTrackPreSelector
 
bool filterOnConvTrackHyp
 
edm::EDGetTokenT< edm::View< reco::Track > > genericTracks
 
edm::EDGetTokenT< TrajGsfTrackAssociationCollectiongsfTrajectories
 
edm::EDGetTokenT< TrajTrackAssociationCollectionkfTrajectories
 
double minConvRadius
 
std::unique_ptr< reco::ConversionTrackCollectionoutputTrks
 
bool setArbitratedEcalSeeded
 
bool setArbitratedMerged
 
bool setArbitratedMergedEcalGeneral
 
bool setTrackerOnly
 
std::string trackProducer
 
bool useTrajectory
 

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
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 43 of file ConversionTrackProducer.h.

Member Typedef Documentation

Definition at line 48 of file ConversionTrackProducer.h.

Constructor & Destructor Documentation

ConversionTrackProducer::ConversionTrackProducer ( const edm::ParameterSet conf)
explicit

Definition at line 36 of file ConversionTrackProducer.cc.

References genericTracks, gsfTrajectories, kfTrajectories, and trackProducer.

36  :
37  conf_(conf),
38  trackProducer ( conf.getParameter<std::string>("TrackProducer") ),
39  useTrajectory ( conf.getParameter<bool>("useTrajectory") ),
40  setTrackerOnly ( conf.getParameter<bool>("setTrackerOnly") ),
41  setArbitratedEcalSeeded ( conf.getParameter<bool>("setArbitratedEcalSeeded") ),
42  setArbitratedMerged ( conf.getParameter<bool>("setArbitratedMerged") ),
43  setArbitratedMergedEcalGeneral ( conf.getParameter<bool>("setArbitratedMergedEcalGeneral") ),
44  beamSpotInputTag ( consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpotInputTag")) ),
45  filterOnConvTrackHyp( conf.getParameter<bool>("filterOnConvTrackHyp") ),
46  minConvRadius( conf.getParameter<double>("minConvRadius") )
47 {
50  consumes<edm::View<reco::Track> >(thetp);
52  consumes<TrajTrackAssociationCollection>(thetp);
54  consumes<TrajGsfTrackAssociationCollection>(thetp);
55  produces<reco::ConversionTrackCollection>();
56 
57 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Track > > genericTracks
edm::EDGetTokenT< TrajTrackAssociationCollection > kfTrajectories
edm::EDGetTokenT< reco::BeamSpot > beamSpotInputTag
edm::EDGetTokenT< TrajGsfTrackAssociationCollection > gsfTrajectories
ConversionTrackProducer::~ConversionTrackProducer ( )
virtual

Definition at line 61 of file ConversionTrackProducer.cc.

61 { }

Member Function Documentation

void ConversionTrackProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Definition at line 64 of file ConversionTrackProducer.cc.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, beamSpotInputTag, edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::GsfTrackCollection, unsigned short > >::const_iterator, ConvTrackPreSelector, edm::AssociationMap< Tag >::end(), filterOnConvTrackHyp, genericTracks, edm::EventSetup::get(), edm::Event::getByToken(), gsfTrajectories, mps_fire::i, IdealHelixParameters::isTangentPointDistanceLessThan(), kfTrajectories, minConvRadius, eostools::move(), outputTrks, edm::ESHandle< T >::product(), edm::Event::put(), setArbitratedEcalSeeded, setArbitratedMerged, setArbitratedMergedEcalGeneral, reco::ConversionTrack::setIsArbitratedEcalSeeded(), reco::ConversionTrack::setIsArbitratedMerged(), reco::ConversionTrack::setIsArbitratedMergedEcalGeneral(), reco::ConversionTrack::setIsTrackerOnly(), IdealHelixParameters::setMagnField(), setTrackerOnly, reco::ConversionTrack::setTrajRef(), and useTrajectory.

65  {
66  //get input collection (through edm::View)
68  e.getByToken(genericTracks, hTrks);
69 
70  //get association maps between trajectories and tracks and build temporary maps
73 
74  std::map<reco::TrackRef,edm::Ref<std::vector<Trajectory> > > tracktrajmap;
75  std::map<reco::GsfTrackRef,edm::Ref<std::vector<Trajectory> > > gsftracktrajmap;
76 
77  if (useTrajectory) {
78  if (hTrks->size()>0) {
79  if (dynamic_cast<const reco::GsfTrack*>(&hTrks->at(0))) {
80  //fill map for gsf tracks
81  e.getByToken(gsfTrajectories, hTTAssGsf);
83  hTTAssGsf->begin();
84  iPair != hTTAssGsf->end(); ++iPair) {
85 
86  gsftracktrajmap[iPair->val] = iPair->key;
87 
88  }
89 
90  }
91  else {
92  //fill map for standard tracks
93  e.getByToken(kfTrajectories, hTTAss);
95  iPair != hTTAss->end();
96  ++iPair) {
97 
98  tracktrajmap[iPair->val] = iPair->key;
99 
100  }
101  }
102  }
103  }
104 
105  // Step B: create empty output collection
106  outputTrks = std::make_unique<reco::ConversionTrackCollection>();
107 
108  //--------------------------------------------------
109  //Added by D. Giordano
110  // 2011/08/05
111  // Reduction of the track sample based on geometric hypothesis for conversion tracks
112 
113  edm::Handle<reco::BeamSpot> beamSpotHandle;
114  e.getByToken(beamSpotInputTag,beamSpotHandle);
115 
116  edm::ESHandle<MagneticField> magFieldHandle;
117  es.get<IdealMagneticFieldRecord>().get( magFieldHandle );
118 
119 
120  if(filterOnConvTrackHyp && !beamSpotHandle.isValid()) {
121  edm::LogError("Invalid Collection")
122  << "invalid collection for the BeamSpot";
123  throw;
124  }
125 
126  ConvTrackPreSelector.setMagnField(magFieldHandle.product());
127 
128  //----------------------------------------------------------
129 
130 
131  // Simple conversion of tracks to conversion tracks, setting appropriate flags from configuration
132  for (size_t i = 0; i < hTrks->size(); ++i) {
133 
134  //--------------------------------------------------
135  //Added by D. Giordano
136  // 2011/08/05
137  // Reduction of the track sample based on geometric hypothesis for conversion tracks
138 
139  math::XYZVector beamSpot= math::XYZVector(beamSpotHandle->position());
140  edm::RefToBase<reco::Track> trackBaseRef = hTrks->refAt(i);
142  continue;
143  //--------------------------------------------------
144 
145  reco::ConversionTrack convTrack(trackBaseRef);
146  convTrack.setIsTrackerOnly(setTrackerOnly);
147  convTrack.setIsArbitratedEcalSeeded(setArbitratedEcalSeeded);
148  convTrack.setIsArbitratedMerged(setArbitratedMerged);
149  convTrack.setIsArbitratedMergedEcalGeneral(setArbitratedMergedEcalGeneral);
150 
151  //fill trajectory association if configured, using correct map depending on track type
152  if (useTrajectory) {
153  if (gsftracktrajmap.size()) {
154  convTrack.setTrajRef(gsftracktrajmap.find(trackBaseRef.castTo<reco::GsfTrackRef>())->second);
155  }
156  else {
157  convTrack.setTrajRef(tracktrajmap.find(trackBaseRef.castTo<reco::TrackRef>())->second);
158  }
159  }
160 
161  outputTrks->push_back(convTrack);
162  }
163 
165  return;
166 
167  }//end produce
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
const_iterator end() const
last iterator over the map (read only)
void setMagnField(const MagneticField *magnField)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< edm::View< reco::Track > > genericTracks
edm::EDGetTokenT< TrajTrackAssociationCollection > kfTrajectories
std::unique_ptr< reco::ConversionTrackCollection > outputTrks
IdealHelixParameters ConvTrackPreSelector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
edm::EDGetTokenT< reco::BeamSpot > beamSpotInputTag
edm::EDGetTokenT< TrajGsfTrackAssociationCollection > gsfTrajectories
bool isTangentPointDistanceLessThan(float rmax, const reco::Track *track, const math::XYZVector &refPoint)
const_iterator begin() const
first iterator over the map (read only)
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> ConversionTrackProducer::beamSpotInputTag
private

Definition at line 77 of file ConversionTrackProducer.h.

Referenced by produce().

edm::ParameterSet ConversionTrackProducer::conf_
private

Definition at line 60 of file ConversionTrackProducer.h.

IdealHelixParameters ConversionTrackProducer::ConvTrackPreSelector
private

Definition at line 80 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::filterOnConvTrackHyp
private

Definition at line 78 of file ConversionTrackProducer.h.

Referenced by produce().

edm::EDGetTokenT<edm::View<reco::Track> > ConversionTrackProducer::genericTracks
private

Definition at line 63 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

edm::EDGetTokenT<TrajGsfTrackAssociationCollection> ConversionTrackProducer::gsfTrajectories
private

Definition at line 65 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

edm::EDGetTokenT<TrajTrackAssociationCollection> ConversionTrackProducer::kfTrajectories
private

Definition at line 64 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

double ConversionTrackProducer::minConvRadius
private

Definition at line 79 of file ConversionTrackProducer.h.

Referenced by produce().

std::unique_ptr<reco::ConversionTrackCollection> ConversionTrackProducer::outputTrks
private

Definition at line 83 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedEcalSeeded
private

Definition at line 68 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMerged
private

Definition at line 69 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMergedEcalGeneral
private

Definition at line 70 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setTrackerOnly
private

Definition at line 67 of file ConversionTrackProducer.h.

Referenced by produce().

std::string ConversionTrackProducer::trackProducer
private

Definition at line 62 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer().

bool ConversionTrackProducer::useTrajectory
private

Definition at line 66 of file ConversionTrackProducer.h.

Referenced by produce().