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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 45 of file ConversionTrackProducer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file ConversionTrackProducer.cc.

References genericTracks, gsfTrajectories, kfTrajectories, and trackProducer.

36  : conf_(conf),
37  trackProducer(conf.getParameter<std::string>("TrackProducer")),
38  useTrajectory(conf.getParameter<bool>("useTrajectory")),
39  setTrackerOnly(conf.getParameter<bool>("setTrackerOnly")),
40  setIsGsfTrackOpen(conf.getParameter<bool>("setIsGsfTrackOpen")),
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")) {
48  genericTracks = consumes<edm::View<reco::Track> >(thetp);
49  kfTrajectories = consumes<TrajTrackAssociationCollection>(thetp);
50  gsfTrajectories = consumes<TrajGsfTrackAssociationCollection>(thetp);
51  produces<reco::ConversionTrackCollection>();
52 }
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 55 of file ConversionTrackProducer.cc.

55 {}

Member Function Documentation

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

Definition at line 58 of file ConversionTrackProducer.cc.

References pwdgSkimBPark_cfi::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.

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

Referenced by produce().

edm::ParameterSet ConversionTrackProducer::conf_
private

Definition at line 55 of file ConversionTrackProducer.h.

IdealHelixParameters ConversionTrackProducer::ConvTrackPreSelector
private

Definition at line 76 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::filterOnConvTrackHyp
private

Definition at line 74 of file ConversionTrackProducer.h.

Referenced by produce().

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

Definition at line 58 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

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

Definition at line 60 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

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

Definition at line 59 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

double ConversionTrackProducer::minConvRadius
private

Definition at line 75 of file ConversionTrackProducer.h.

Referenced by produce().

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

Definition at line 79 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedEcalSeeded
private

Definition at line 64 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMerged
private

Definition at line 65 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMergedEcalGeneral
private

Definition at line 66 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setIsGsfTrackOpen
private

Definition at line 63 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setTrackerOnly
private

Definition at line 62 of file ConversionTrackProducer.h.

Referenced by produce().

std::string ConversionTrackProducer::trackProducer
private

Definition at line 57 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer().

bool ConversionTrackProducer::useTrajectory
private

Definition at line 61 of file ConversionTrackProducer.h.

Referenced by produce().