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 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
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< TrajGsfTrackAssociationCollection
gsfTrajectories
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
kfTrajectories
 
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::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::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 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

Implements edm::stream::EDProducerBase.

Definition at line 64 of file ConversionTrackProducer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotInputTag, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::GsfTrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, ConvTrackPreSelector, filterOnConvTrackHyp, genericTracks, edm::EventSetup::get(), edm::Event::getByToken(), gsfTrajectories, i, IdealHelixParameters::isTangentPointDistanceLessThan(), kfTrajectories, 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(), 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);
94  for ( TrajTrackAssociationCollection::const_iterator iPair = hTTAss->begin();
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::auto_ptr<reco::ConversionTrackCollection>(new 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 
164  e.put(outputTrks);
165  return;
166 
167  }//end produce
int i
Definition: DBlmapReader.cc:9
void setMagnField(const MagneticField *magnField)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< edm::View< reco::Track > > genericTracks
edm::EDGetTokenT< TrajTrackAssociationCollection > kfTrajectories
std::vector< ConversionTrack > ConversionTrackCollection
collection of ConversionTracks
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::auto_ptr< reco::ConversionTrackCollection > outputTrks
IdealHelixParameters ConvTrackPreSelector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
edm::EDGetTokenT< reco::BeamSpot > beamSpotInputTag
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< TrajGsfTrackAssociationCollection > gsfTrajectories
bool isTangentPointDistanceLessThan(float rmax, const reco::Track *track, const math::XYZVector &refPoint)

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::auto_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().