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
SeedToTrackProducer Class Reference

#include <hugues/SeedToTrackProducer/plugins/SeedToTrackProducer.cc>

Inheritance diagram for SeedToTrackProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SeedToTrackProducer (const edm::ParameterSet &)
 
 ~SeedToTrackProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual TrajectoryStateOnSurface seedTransientState (const TrajectorySeed &)
 

Private Attributes

edm::EDGetTokenT< edm::View
< TrajectorySeed > > 
L2seedsTagS_
 
edm::EDGetTokenT
< TrajectorySeedCollection
L2seedsTagT_
 
edm::ESHandle< MagneticFieldtheMGField
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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]

Description:

Definition at line 53 of file SeedToTrackProducer.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file SeedToTrackProducer.cc.

References edm::ParameterSet::getParameter(), L2seedsTagS_, and L2seedsTagT_.

48 {
49 
50  L2seedsTagT_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));
51  L2seedsTagS_ = consumes<edm::View<TrajectorySeed> >(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));
52 
53 
54 
55 
56  produces<reco::TrackCollection>();
57  produces<reco::TrackExtraCollection>();
58  produces<TrackingRecHitCollection>();
59 
60 
61 }
T getParameter(std::string const &) const
edm::EDGetTokenT< TrajectorySeedCollection > L2seedsTagT_
edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
SeedToTrackProducer::~SeedToTrackProducer ( )

Definition at line 64 of file SeedToTrackProducer.cc.

65 {
66 
67  // do anything here that needs to be done at desctruction time
68  // (e.g. close files, deallocate resources etc.)
69 
70 }

Member Function Documentation

void SeedToTrackProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 182 of file SeedToTrackProducer.cc.

183 {
184 }
void SeedToTrackProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 188 of file SeedToTrackProducer.cc.

188  {
189 }
void SeedToTrackProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 225 of file SeedToTrackProducer.cc.

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

225  {
226  //The following says we do not know what parameters are allowed so do no validation
227  // Please change this to state exactly what you do use, even if it is no parameters
229  desc.setUnknown();
230  descriptions.addDefault(desc);
231 }
void addDefault(ParameterSetDescription const &psetDescription)
void SeedToTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 79 of file SeedToTrackProducer.cc.

References reco::TrackBase::appendHitPattern(), clone(), funct::cos(), TrajectoryStateOnSurface::curvilinearError(), PV3DBase< T, PVType, FrameType >::eta(), reco::TrackBase::eta(), edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalMomentum(), susybsm::HSCParticleType::globalMuon, i, customizeTrackingMonitorSeedNumber::idx, L2seedsTagS_, L2seedsTagT_, CurvilinearTrajectoryError::matrix(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), reco::TrackBase::phi(), reco::TrackBase::phiError(), reco::TrackBase::pt(), reco::TrackBase::ptError(), edm::Event::put(), HLT_25ns14e33_v3_cff::recHits, fileCollector::seed, seedTransientState(), TrackCollections2monitor_cff::selectedTracks, reco::Track::setExtra(), funct::sin(), theMGField, and theTrackingGeometry.

80 {
81  using namespace edm;
82  using namespace std;
83 
84  std::auto_ptr<reco::TrackCollection> selectedTracks(new reco::TrackCollection);
85  std::auto_ptr<reco::TrackExtraCollection> selectedTrackExtras( new reco::TrackExtraCollection() );
86  std::auto_ptr<TrackingRecHitCollection> selectedTrackHits( new TrackingRecHitCollection() );
87 
91 
94 
95  // magnetic fied and detector geometry
98 
100  iSetup.get<TrackerTopologyRcd>().get(httopo);
101  const TrackerTopology& ttopo = *httopo;
102 
103  // now read the L2 seeds collection :
104  edm::Handle<TrajectorySeedCollection> L2seedsCollection;
105  iEvent.getByToken(L2seedsTagT_,L2seedsCollection);
106  const std::vector<TrajectorySeed>* L2seeds = 0;
107  if (L2seedsCollection.isValid()) L2seeds = L2seedsCollection.product();
108  else edm::LogError("SeedToTrackProducer") << "L2 seeds collection not found !! " << endl;
109 
111  iEvent.getByToken(L2seedsTagS_, seedHandle);
112 
113 
114  int countRH = 0;
115 
116  // now loop on the seeds :
117  for (unsigned int i = 0; i < L2seeds->size() ; i++){
118 
119 
120  //get the kinematic extrapolation from the seed
121  TrajectoryStateOnSurface theTrajectory = seedTransientState(L2seeds->at(i));
122  float seedEta = theTrajectory.globalMomentum().eta();
123  float seedPhi = theTrajectory.globalMomentum().phi();
124  float seedPt = theTrajectory.globalMomentum().perp();
125  CovarianceMatrix matrixSeedErr = theTrajectory.curvilinearError().matrix();
126  edm::LogVerbatim("SeedToTrackProducer") << "seedPt=" << seedPt << " seedEta=" << seedEta << " seedPhi=" << seedPhi << endl;
127  /*AlgebraicSymMatrix66 errors = theTrajectory.cartesianError().matrix();
128  double partialPterror = errors(3,3)*pow(theTrajectory.globalMomentum().x(),2) + errors(4,4)*pow(theTrajectory.globalMomentum().y(),2);
129  edm::LogVerbatim("SeedToTrackProducer") << "seedPtError=" << sqrt(partialPterror)/theTrajectory.globalMomentum().perp() << "seedPhiError=" << theTrajectory.curvilinearError().matrix()(2,2) << endl;*/
130  //fill the track in a way that its pt, phi and eta will be the same as the seed
131  math::XYZPoint initPoint(0,0,0);
132  math::XYZVector initMom(seedPt*cos(seedPhi),seedPt*sin(seedPhi),seedPt*sinh(seedEta));
133  reco::Track theTrack(1, 1, //dummy Chi2 and ndof
134  initPoint, initMom,
135  1, matrixSeedErr,
136  reco::TrackBase::TrackAlgorithm::globalMuon, reco::TrackBase::TrackQuality::tight);
137 
138  //fill the extra track with dummy information
139  math::XYZPoint dummyFinalPoint(1,1,1);
140  math::XYZVector dummyFinalMom(0,0,10);
142  CovarianceMatrix matrixExtra = ROOT::Math::SMatrixIdentity();
143  reco::TrackExtra theTrackExtra(dummyFinalPoint, dummyFinalMom, true, initPoint, initMom, true,
144  matrixSeedErr, 1,
145  matrixExtra, 2,
146  (L2seeds->at(i)).direction(), seed);
147  theTrack.setExtra( reco::TrackExtraRef( rTrackExtras, idx++ ) );
148  edm::LogVerbatim("SeedToTrackProducer") << "trackPt=" << theTrack.pt() << " trackEta=" << theTrack.eta() << " trackPhi=" << theTrack.phi() << endl;
149  edm::LogVerbatim("SeedToTrackProducer") << "trackPtError=" << theTrack.ptError() << "trackPhiError=" << theTrack.phiError() << endl;
150 
151  //fill the seed segments in the track
152  unsigned int nHitsAdded = 0;
153  for(TrajectorySeed::recHitContainer::const_iterator itRecHits=(L2seeds->at(i)).recHits().first; itRecHits!=(L2seeds->at(i)).recHits().second; ++itRecHits, ++countRH) {
154  TrackingRecHit* hit = (itRecHits)->clone();
155  theTrack.appendHitPattern(*hit, ttopo);
156  selectedTrackHits->push_back(hit);
157  nHitsAdded++;
158  }
159  theTrackExtra.setHits( rHits, hidx, nHitsAdded );
160  hidx += nHitsAdded;
161  selectedTracks->push_back(theTrack);
162  selectedTrackExtras->push_back(theTrackExtra);
163 
164  }
165  iEvent.put(selectedTracks);
166  iEvent.put(selectedTrackExtras);
167  iEvent.put(selectedTrackHits);
168 
169 }
int i
Definition: DBlmapReader.cc:9
T perp() const
Definition: PV3DBase.h:72
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
const CurvilinearTrajectoryError & curvilinearError() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ESHandle< MagneticField > theMGField
virtual TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
edm::EDGetTokenT< TrajectorySeedCollection > L2seedsTagT_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
RefProd< PROD > getRefBeforePut()
Definition: Event.h:140
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const T & get() const
Definition: EventSetup.h:56
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
T eta() const
Definition: PV3DBase.h:76
edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
const AlgebraicSymMatrix55 & matrix() const
GlobalVector globalMomentum() const
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168
TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState ( const TrajectorySeed tmpSeed)
privatevirtual

Definition at line 171 of file SeedToTrackProducer.cc.

References PTrajectoryStateOnDet::detId(), TrajectorySeed::startingState(), theMGField, theTrackingGeometry, and trajectoryStateTransform::transientState().

Referenced by produce().

171  {
172 
173  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
174  DetId tmpDetId(tmpTSOD.detId());
175  const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId);
176  TrajectoryStateOnSurface tmpTSOS = trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMGField));
177  return tmpTSOS;
178 }
edm::ESHandle< MagneticField > theMGField
unsigned int detId() const
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry

Member Data Documentation

edm::EDGetTokenT<edm::View<TrajectorySeed> > SeedToTrackProducer::L2seedsTagS_
private

Definition at line 74 of file SeedToTrackProducer.h.

Referenced by produce(), and SeedToTrackProducer().

edm::EDGetTokenT<TrajectorySeedCollection> SeedToTrackProducer::L2seedsTagT_
private

Definition at line 73 of file SeedToTrackProducer.h.

Referenced by produce(), and SeedToTrackProducer().

edm::ESHandle<MagneticField> SeedToTrackProducer::theMGField
private

Definition at line 76 of file SeedToTrackProducer.h.

Referenced by produce(), and seedTransientState().

edm::ESHandle<GlobalTrackingGeometry> SeedToTrackProducer::theTrackingGeometry
private

Definition at line 77 of file SeedToTrackProducer.h.

Referenced by produce(), and seedTransientState().