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<>

Public Member Functions

 ConversionTrackProducer (const edm::ParameterSet &conf)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~ConversionTrackProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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 setIsGsfTrackOpen
 
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
 

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  setIsGsfTrackOpen ( conf.getParameter<bool>("setIsGsfTrackOpen") ),
42  setArbitratedEcalSeeded ( conf.getParameter<bool>("setArbitratedEcalSeeded") ),
43  setArbitratedMerged ( conf.getParameter<bool>("setArbitratedMerged") ),
44  setArbitratedMergedEcalGeneral ( conf.getParameter<bool>("setArbitratedMergedEcalGeneral") ),
45  beamSpotInputTag ( consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpotInputTag")) ),
46  filterOnConvTrackHyp( conf.getParameter<bool>("filterOnConvTrackHyp") ),
47  minConvRadius( conf.getParameter<double>("minConvRadius") )
48 {
51  consumes<edm::View<reco::Track> >(thetp);
53  consumes<TrajTrackAssociationCollection>(thetp);
55  consumes<TrajGsfTrackAssociationCollection>(thetp);
56  produces<reco::ConversionTrackCollection>();
57 
58 }
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 ( )
override

Definition at line 62 of file ConversionTrackProducer.cc.

62 { }

Member Function Documentation

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

Definition at line 65 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::setIsGsfTrackOpen(), setIsGsfTrackOpen, reco::ConversionTrack::setIsTrackerOnly(), IdealHelixParameters::setMagnField(), setTrackerOnly, reco::ConversionTrack::setTrajRef(), and useTrajectory.

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

Member Data Documentation

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

Definition at line 78 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 81 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::filterOnConvTrackHyp
private

Definition at line 79 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 80 of file ConversionTrackProducer.h.

Referenced by produce().

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

Definition at line 84 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedEcalSeeded
private

Definition at line 69 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMerged
private

Definition at line 70 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMergedEcalGeneral
private

Definition at line 71 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setIsGsfTrackOpen
private

Definition at line 68 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().