CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ConversionTrackProducer Class Reference

#include <ConversionTrackProducer.h>

Inheritance diagram for ConversionTrackProducer:
edm::EDProducer 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::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::InputTag beamSpotInputTag
 
edm::ParameterSet conf_
 
IdealHelixParameters ConvTrackPreSelector
 
bool filterOnConvTrackHyp
 
double minConvRadius
 
std::auto_ptr
< reco::ConversionTrackCollection
outputTrks
 
bool setArbitratedEcalSeeded
 
bool setArbitratedMerged
 
bool setArbitratedMergedEcalGeneral
 
bool setTrackerOnly
 
std::string trackProducer
 
bool useTrajectory
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 40 of file ConversionTrackProducer.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file ConversionTrackProducer.cc.

39  :
40  conf_(conf),
41  trackProducer ( conf.getParameter<std::string>("TrackProducer") ),
42  useTrajectory ( conf.getParameter<bool>("useTrajectory") ),
43  setTrackerOnly ( conf.getParameter<bool>("setTrackerOnly") ),
44  setArbitratedEcalSeeded ( conf.getParameter<bool>("setArbitratedEcalSeeded") ),
45  setArbitratedMerged ( conf.getParameter<bool>("setArbitratedMerged") ),
46  setArbitratedMergedEcalGeneral ( conf.getParameter<bool>("setArbitratedMergedEcalGeneral") ),
47  beamSpotInputTag ( conf.getParameter<edm::InputTag>("beamSpotInputTag") ),
48  filterOnConvTrackHyp( conf.getParameter<bool>("filterOnConvTrackHyp") ),
49  minConvRadius( conf.getParameter<double>("minConvRadius") )
50 {
51 
52  produces<reco::ConversionTrackCollection>();
53 
54 }
T getParameter(std::string const &) const
ConversionTrackProducer::~ConversionTrackProducer ( )
virtual

Definition at line 58 of file ConversionTrackProducer.cc.

58 { }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 61 of file ConversionTrackProducer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotInputTag, ConvTrackPreSelector, filterOnConvTrackHyp, edm::EventSetup::get(), edm::Event::getByLabel(), IdealHelixParameters::isTangentPointDistanceLessThan(), minConvRadius, outputTrks, edm::ESHandle< class >::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(), trackProducer, and useTrajectory.

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

Member Data Documentation

edm::InputTag ConversionTrackProducer::beamSpotInputTag
private

Definition at line 67 of file ConversionTrackProducer.h.

Referenced by produce().

edm::ParameterSet ConversionTrackProducer::conf_
private

Definition at line 53 of file ConversionTrackProducer.h.

IdealHelixParameters ConversionTrackProducer::ConvTrackPreSelector
private

Definition at line 70 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::filterOnConvTrackHyp
private

Definition at line 68 of file ConversionTrackProducer.h.

Referenced by produce().

double ConversionTrackProducer::minConvRadius
private

Definition at line 69 of file ConversionTrackProducer.h.

Referenced by produce().

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

Definition at line 73 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedEcalSeeded
private

Definition at line 58 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMerged
private

Definition at line 59 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setArbitratedMergedEcalGeneral
private

Definition at line 60 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::setTrackerOnly
private

Definition at line 57 of file ConversionTrackProducer.h.

Referenced by produce().

std::string ConversionTrackProducer::trackProducer
private

Definition at line 55 of file ConversionTrackProducer.h.

Referenced by produce().

bool ConversionTrackProducer::useTrajectory
private

Definition at line 56 of file ConversionTrackProducer.h.

Referenced by produce().