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

◆ TrajGsfTrackAssociationCollection

Definition at line 45 of file ConversionTrackProducer.h.

Constructor & Destructor Documentation

◆ ConversionTrackProducer()

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

Definition at line 35 of file ConversionTrackProducer.cc.

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 }

References genericTracks, gsfTrajectories, kfTrajectories, and trackProducer.

◆ ~ConversionTrackProducer()

ConversionTrackProducer::~ConversionTrackProducer ( )
override

Definition at line 55 of file ConversionTrackProducer.cc.

55 {}

Member Function Documentation

◆ produce()

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

Definition at line 58 of file ConversionTrackProducer.cc.

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 
146  e.put(std::move(outputTrks));
147  return;
148 
149 } //end produce

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, MillePedeFileConverter_cfg::e, edm::AssociationMap< Tag >::end(), filterOnConvTrackHyp, genericTracks, edm::EventSetup::get(), get, gsfTrajectories, mps_fire::i, IdealHelixParameters::isTangentPointDistanceLessThan(), edm::HandleBase::isValid(), kfTrajectories, minConvRadius, eostools::move(), outputTrks, reco::BeamSpot::position(), edm::ESHandle< T >::product(), 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.

Member Data Documentation

◆ beamSpotInputTag

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

Definition at line 73 of file ConversionTrackProducer.h.

Referenced by produce().

◆ conf_

edm::ParameterSet ConversionTrackProducer::conf_
private

Definition at line 55 of file ConversionTrackProducer.h.

◆ ConvTrackPreSelector

IdealHelixParameters ConversionTrackProducer::ConvTrackPreSelector
private

Definition at line 76 of file ConversionTrackProducer.h.

Referenced by produce().

◆ filterOnConvTrackHyp

bool ConversionTrackProducer::filterOnConvTrackHyp
private

Definition at line 74 of file ConversionTrackProducer.h.

Referenced by produce().

◆ genericTracks

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

Definition at line 58 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

◆ gsfTrajectories

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

Definition at line 60 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

◆ kfTrajectories

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

Definition at line 59 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer(), and produce().

◆ minConvRadius

double ConversionTrackProducer::minConvRadius
private

Definition at line 75 of file ConversionTrackProducer.h.

Referenced by produce().

◆ outputTrks

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

Definition at line 79 of file ConversionTrackProducer.h.

Referenced by produce().

◆ setArbitratedEcalSeeded

bool ConversionTrackProducer::setArbitratedEcalSeeded
private

Definition at line 64 of file ConversionTrackProducer.h.

Referenced by produce().

◆ setArbitratedMerged

bool ConversionTrackProducer::setArbitratedMerged
private

Definition at line 65 of file ConversionTrackProducer.h.

Referenced by produce().

◆ setArbitratedMergedEcalGeneral

bool ConversionTrackProducer::setArbitratedMergedEcalGeneral
private

Definition at line 66 of file ConversionTrackProducer.h.

Referenced by produce().

◆ setIsGsfTrackOpen

bool ConversionTrackProducer::setIsGsfTrackOpen
private

Definition at line 63 of file ConversionTrackProducer.h.

Referenced by produce().

◆ setTrackerOnly

bool ConversionTrackProducer::setTrackerOnly
private

Definition at line 62 of file ConversionTrackProducer.h.

Referenced by produce().

◆ trackProducer

std::string ConversionTrackProducer::trackProducer
private

Definition at line 57 of file ConversionTrackProducer.h.

Referenced by ConversionTrackProducer().

◆ useTrajectory

bool ConversionTrackProducer::useTrajectory
private

Definition at line 61 of file ConversionTrackProducer.h.

Referenced by produce().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:355
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
reco::ConversionTrack
Definition: ConversionTrack.h:19
ConversionTrackProducer::minConvRadius
double minConvRadius
Definition: ConversionTrackProducer.h:75
ConversionTrackProducer::conf_
edm::ParameterSet conf_
Definition: ConversionTrackProducer.h:55
edm::Handle
Definition: AssociativeIterator.h:50
ConversionTrackProducer::setTrackerOnly
bool setTrackerOnly
Definition: ConversionTrackProducer.h:62
ConversionTrackProducer::setArbitratedMerged
bool setArbitratedMerged
Definition: ConversionTrackProducer.h:65
edm::Ref< GsfTrackCollection >
ConversionTrackProducer::kfTrajectories
edm::EDGetTokenT< TrajTrackAssociationCollection > kfTrajectories
Definition: ConversionTrackProducer.h:59
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
IdealHelixParameters::setMagnField
void setMagnField(const MagneticField *magnField)
Definition: IdealHelixParameters.h:31
ConversionTrackProducer::genericTracks
edm::EDGetTokenT< edm::View< reco::Track > > genericTracks
Definition: ConversionTrackProducer.h:58
edm::ESHandle< MagneticField >
ConversionTrackProducer::setArbitratedMergedEcalGeneral
bool setArbitratedMergedEcalGeneral
Definition: ConversionTrackProducer.h:66
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ConversionTrackProducer::setArbitratedEcalSeeded
bool setArbitratedEcalSeeded
Definition: ConversionTrackProducer.h:64
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::GsfTrackCollection, unsigned short > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
ConversionTrackProducer::useTrajectory
bool useTrajectory
Definition: ConversionTrackProducer.h:61
ConversionTrackProducer::filterOnConvTrackHyp
bool filterOnConvTrackHyp
Definition: ConversionTrackProducer.h:74
edm::LogError
Definition: MessageLogger.h:183
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
ConversionTrackProducer::gsfTrajectories
edm::EDGetTokenT< TrajGsfTrackAssociationCollection > gsfTrajectories
Definition: ConversionTrackProducer.h:60
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ConversionTrackProducer::trackProducer
std::string trackProducer
Definition: ConversionTrackProducer.h:57
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
edm::RefToBase< reco::Track >
ConversionTrackProducer::beamSpotInputTag
edm::EDGetTokenT< reco::BeamSpot > beamSpotInputTag
Definition: ConversionTrackProducer.h:73
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
ConversionTrackProducer::outputTrks
std::unique_ptr< reco::ConversionTrackCollection > outputTrks
Definition: ConversionTrackProducer.h:79
ConversionTrackProducer::ConvTrackPreSelector
IdealHelixParameters ConvTrackPreSelector
Definition: ConversionTrackProducer.h:76
edm::InputTag
Definition: InputTag.h:15
IdealHelixParameters::isTangentPointDistanceLessThan
bool isTangentPointDistanceLessThan(float rmax, const reco::Track *track, const math::XYZVector &refPoint)
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ConversionTrackProducer::setIsGsfTrackOpen
bool setIsGsfTrackOpen
Definition: ConversionTrackProducer.h:63