test
CMS 3D CMS Logo

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

#include <FastSimulation/TrackFromSeedProducer/plugins/TrackFromSeedProducer.cc>

Inheritance diagram for TrackFromSeedProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackFromSeedProducer (const edm::ParameterSet &)
 
 ~TrackFromSeedProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
edm::EDGetTokenT< std::vector
< TrajectorySeed > > 
seedsToken
 
std::string tTRHBuilderName
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file TrackFromSeedProducer.cc.

Constructor & Destructor Documentation

TrackFromSeedProducer::TrackFromSeedProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 77 of file TrackFromSeedProducer.cc.

References HLT_25ns14e33_v1_cff::beamSpotTag, beamSpotToken, edm::ParameterSet::getParameter(), seedsToken, AlCaHLTBitMon_QueryRunRegistry::string, and tTRHBuilderName.

78 {
79  //register your products
80  produces<reco::TrackCollection>();
81  produces<TrackingRecHitCollection>();
82  produces<reco::TrackExtraCollection>();
83  produces<std::vector<int> >();
84 
85  // read parametes
86  edm::InputTag seedsTag(iConfig.getParameter<edm::InputTag>("src"));
88  tTRHBuilderName = iConfig.getParameter<std::string>("TTRHBuilder");
89 
90  //consumes
91  seedsToken = consumes<std::vector<TrajectorySeed> >(seedsTag);
92  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag);
93 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
edm::EDGetTokenT< std::vector< TrajectorySeed > > seedsToken
TrackFromSeedProducer::~TrackFromSeedProducer ( )

Definition at line 96 of file TrackFromSeedProducer.cc.

96 {}

Member Function Documentation

void TrackFromSeedProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 184 of file TrackFromSeedProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

184  {
185  //The following says we do not know what parameters are allowed so do no validation
186  // Please change this to state exactly what you do use, even if it is no parameters
188  desc.setUnknown();
189  descriptions.addDefault(desc);
190 }
void addDefault(ParameterSetDescription const &psetDescription)
void TrackFromSeedProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 100 of file TrackFromSeedProducer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotToken, TrajectoryStateOnSurface::freeState(), PerigeeConversions::ftsToPerigeeError(), edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), edm::Event::put(), HI_PhotonSkim_cff::rechits, dt_dqm_sourceclient_common_cff::reco, fileCollector::seed, seedsToken, testEve_cfg::tracks, trajectoryStateTransform::transientState(), and tTRHBuilderName.

101 {
102  using namespace edm;
103  using namespace reco;
104  using namespace std;
105 
106  // output collection
107  auto_ptr<TrackCollection> tracks(new TrackCollection);
108  auto_ptr<TrackingRecHitCollection> rechits(new TrackingRecHitCollection);
109  auto_ptr<TrackExtraCollection> trackextras(new TrackExtraCollection);
110  auto_ptr<vector<int> > seedToTrack(new vector<int>());
111 
112  // product references
113  TrackExtraRefProd ref_trackextras = iEvent.getRefBeforePut<TrackExtraCollection>();
115 
116  // input collection
118  iEvent.getByToken(seedsToken,seeds);
119 
120  // beam spot
123 
124  // some objects to build to tracks
125  TSCBLBuilderNoMaterial tscblBuilder;
126 
128  iSetup.get<TransientRecHitRecord>().get(tTRHBuilderName,tTRHBuilder);
129 
131  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
132 
134  iSetup.get<TrackerTopologyRcd>().get(httopo);
135  const TrackerTopology& ttopo = *httopo;
136 
137  // create tracks from seeds
138  int nfailed = 0;
139  for (auto const & seed : *seeds.product()){
140  // try to create a track
141  TransientTrackingRecHit::RecHitPointer lastRecHit = tTRHBuilder->build(&*(seed.recHits().second-1));
142  TrajectoryStateOnSurface state = trajectoryStateTransform::transientState( seed.startingState(), lastRecHit->surface(), theMF.product());
143  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed = tscblBuilder(*state.freeState(),*beamSpot);//as in TrackProducerAlgorithm
144  if(!(tsAtClosestApproachSeed.isValid())){
145  edm::LogVerbatim("SeedValidator")<<"TrajectoryStateClosestToBeamLine not valid";
146  seedToTrack->push_back(-1);
147  nfailed++;
148  continue;
149  }
150  const reco::TrackBase::Point vSeed1(tsAtClosestApproachSeed.trackStateAtPCA().position().x(),
151  tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
152  tsAtClosestApproachSeed.trackStateAtPCA().position().z());
153  const reco::TrackBase::Vector pSeed(tsAtClosestApproachSeed.trackStateAtPCA().momentum().x(),
154  tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
155  tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
156  //GlobalPoint vSeed(vSeed1.x()-beamSpot->x0(),vSeed1.y()-beamSpot->y0(),vSeed1.z()-beamSpot->z0());
157  PerigeeTrajectoryError seedPerigeeErrors = PerigeeConversions::ftsToPerigeeError(tsAtClosestApproachSeed.trackStateAtPCA());
158  tracks->push_back(Track(0.,0., vSeed1, pSeed, 1, seedPerigeeErrors.covarianceMatrix()));
159  seedToTrack->push_back(tracks->size()-1);
160  tracks->back().appendHits(seed.recHits().first,seed.recHits().second,ttopo);
161  // store the hits
162  size_t firsthitindex = rechits->size();
163  for(auto hitit = seed.recHits().first;hitit != seed.recHits().second;++hitit){
164  rechits->push_back(*hitit);
165  }
166  // create a trackextra, just to store the hit range
167  trackextras->push_back(TrackExtra());
168  trackextras->back().setHits(ref_rechits,firsthitindex,rechits->size() - firsthitindex);
169  // create link between track and trackextra
170  tracks->back().setExtra( TrackExtraRef( ref_trackextras, trackextras->size() - 1) );
171  }
172 
173  if (nfailed > 0) {
174  edm::LogWarning("SeedValidator") << "failed to create tracks from " << nfailed << " out of " << seeds->size() << " seeds ";
175  }
176  iEvent.put(tracks);
177  iEvent.put(seedToTrack);
178  iEvent.put(rechits);
179  iEvent.put(trackextras);
180 }
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:17
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
FreeTrajectoryState const * freeState(bool withErrors=true) const
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
std::shared_ptr< TrackingRecHit const > RecHitPointer
RefProd< PROD > getRefBeforePut()
Definition: Event.h:140
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56
edm::EDGetTokenT< std::vector< TrajectorySeed > > seedsToken
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:80

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> TrackFromSeedProducer::beamSpotToken
private

Definition at line 61 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

edm::EDGetTokenT<std::vector<TrajectorySeed> > TrackFromSeedProducer::seedsToken
private

Definition at line 60 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

std::string TrackFromSeedProducer::tTRHBuilderName
private

Definition at line 62 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().