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 Member Functions | Private Attributes
MuonSeedTrack Class Reference

#include <MuonSeedTrack.h>

Inheritance diagram for MuonSeedTrack:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 MuonSeedTrack (const edm::ParameterSet &)
 constructor with config More...
 
 ~MuonSeedTrack ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 pre-job booking More...
 
std::pair< bool, reco::TrackbuildTrackAtPCA (const TrajectorySeed &) const
 Build a track at the PCA WITHOUT any vertex constriant. More...
 
double computeNDOF (const TrajectorySeed &) const
 compute the TrajectorySeed's degree of freedom More...
 
virtual void endJob ()
 post-job More...
 
TrajectoryStateOnSurface getSeedTSOS (const TrajectorySeed &seed) const
 get the TrajectorySeed's TrajectoryStateOnSurface More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 construct proto-tracks More...
 
void setAlias (std::string alias)
 set the Branch alias More...
 

Private Attributes

std::string theAlias
 the Branch alias More...
 
bool theAllowNoVtxFlag
 
edm::InputTag theSeedsLabel
 the propagator used for extracting TSOS from seed More...
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
MuonUpdatorAtVertextheUpdatorAtVtx
 the class used for updating a Trajectory State at veretex More...
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Make a (fake) reco::Track from a TrajectorySeed. The (fake) track can be associated to a TrackingParticle (SimTrack) using SimTracker/TrackAssociation. The association can then be used in Validation packages, such as Validation/RecoMuon/MuonTrackValidator.cc

Date:
2010/03/22 08:49:54
Revision:
1.3
Author
Adam Everett Purdue University

Definition at line 43 of file MuonSeedTrack.h.

Constructor & Destructor Documentation

MuonSeedTrack::MuonSeedTrack ( const edm::ParameterSet pset)
explicit

constructor with config

Definition at line 42 of file MuonSeedTrack.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonServiceProxy_cff::MuonServiceProxy, and MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex.

43 {
44  // service parameters
45  ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
46  theService = new MuonServiceProxy(serviceParameters);
47 
48  ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
49  //theSeedPropagatorName = updatorPar.getParameter<string>("Propagator");
50  theSeedsLabel = pset.getParameter<InputTag>("MuonSeed");
51  theUpdatorAtVtx = new MuonUpdatorAtVertex(updatorPar,theService);
52 
53  theAllowNoVtxFlag = pset.getUntrackedParameter<bool>("AllowNoVertex",false);
54 
55  //register products
56  setAlias(pset.getParameter<std::string>("@module_label"));
57  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
58 
59 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string theAlias
the Branch alias
Definition: MuonSeedTrack.h:85
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: MuonSeedTrack.h:79
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:82
bool theAllowNoVtxFlag
Definition: MuonSeedTrack.h:94
edm::InputTag theSeedsLabel
the propagator used for extracting TSOS from seed
Definition: MuonSeedTrack.h:91
void setAlias(std::string alias)
set the Branch alias
Definition: MuonSeedTrack.h:65
MuonSeedTrack::~MuonSeedTrack ( )

destructor

Definition at line 64 of file MuonSeedTrack.cc.

65 {
66  if (theService) delete theService;
67  if (theUpdatorAtVtx) delete theUpdatorAtVtx;
68 }
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: MuonSeedTrack.h:79
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:82

Member Function Documentation

void MuonSeedTrack::beginJob ( void  )
privatevirtual

pre-job booking

empty method

Reimplemented from edm::EDProducer.

Definition at line 112 of file MuonSeedTrack.cc.

113 {
114 }
pair< bool, reco::Track > MuonSeedTrack::buildTrackAtPCA ( const TrajectorySeed seed) const
private

Build a track at the PCA WITHOUT any vertex constriant.

First calls getSeedTSOS, then propagates to the vertex. Creates a reco::Track from the propagated initial FreeTrajectoryState.

Definition at line 172 of file MuonSeedTrack.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::curvilinearError(), debug, MuonPatternRecoDumper::dumpFTS(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrackerBounds::isInside(), LogTrace, metname, FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

172  {
173 
174  const string metname = "MuonSeedTrack";
175 
177 
178  TSOS seedTSOS = getSeedTSOS(seed);
179  // This is needed to extrapolate the tsos at vertex
180  LogTrace(metname) << "Propagate to PCA...";
181  pair<bool,FreeTrajectoryState>
182  extrapolationResult = theUpdatorAtVtx->propagateToNominalLine(seedTSOS);
183  FreeTrajectoryState ftsAtVtx;
184 
185  if(extrapolationResult.first) {
186  ftsAtVtx = extrapolationResult.second;
187  } else {
188  if(TrackerBounds::isInside(seedTSOS.globalPosition())){
189  LogWarning(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
190  ftsAtVtx = *seedTSOS.freeState();
191  }
192  else{
193  if ( theAllowNoVtxFlag ) {
194  LogWarning(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
195  ftsAtVtx = *seedTSOS.freeState();
196  } else {
197  LogWarning(metname) << "Stand Alone track: this track will be rejected";
198  return pair<bool,reco::Track>(false,reco::Track());
199  }
200  }
201  }
202 
203  LogTrace(metname) << "TSOS after the extrapolation at vtx";
204  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
205 
206  GlobalPoint pca = ftsAtVtx.position();
207  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
208  GlobalVector p = ftsAtVtx.momentum();
209  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
210 
211  double dummyNDOF = 1.0;
212  //double ndof = computeNDOF(seed);
213  double dummyChi2 = 1.0;
214 
215  reco::Track track(dummyChi2,
216  dummyNDOF,
217  persistentPCA,
218  persistentMomentum,
219  ftsAtVtx.charge(),
220  ftsAtVtx.curvilinearError());
221 
222  return pair<bool,reco::Track>(true,track);
223 }
static bool isInside(const GlobalPoint &)
const std::string metname
T y() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
FreeTrajectoryState * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:63
GlobalVector momentum() const
#define LogTrace(id)
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:82
GlobalPoint position() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed) const
get the TrajectorySeed&#39;s TrajectoryStateOnSurface
bool theAllowNoVtxFlag
Definition: MuonSeedTrack.h:94
#define debug
Definition: MEtoEDMFormat.h:34
T x() const
Definition: PV3DBase.h:61
std::pair< bool, FreeTrajectoryState > propagateToNominalLine(const TrajectoryStateOnSurface &tsos) const
Propagate the state to the 2D-PCA (nominal CMS axis)
double MuonSeedTrack::computeNDOF ( const TrajectorySeed trajectory) const
private

compute the TrajectorySeed's degree of freedom

Calculates number of degrees of freedom for the TrajectorySeed

Definition at line 228 of file MuonSeedTrack.cc.

References max(), metname, and TrajectorySeed::recHits().

228  {
229  const string metname = "MuonSeedTrack";
230 
231  BasicTrajectorySeed::const_iterator recHits1 = (trajectory.recHits().first);
232  BasicTrajectorySeed::const_iterator recHits2 = (trajectory.recHits().second);
233 
234  double ndof = 0.;
235 
236  if ((*recHits1).isValid()) ndof += (*recHits1).dimension();
237  if ((*recHits2).isValid()) ndof += (*recHits2).dimension();
238 
239  //const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
240  //for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
241  // rechit != transRecHits.end(); ++rechit)
242  //if ((*rechit)->isValid()) ndof += (*rechit)->dimension();
243 
244  // FIXME! in case of Boff is dof - 4
245  return max(ndof - 5., 0.);
246 }
const std::string metname
const T & max(const T &a, const T &b)
recHitContainer::const_iterator const_iterator
range recHits() const
void MuonSeedTrack::endJob ( void  )
privatevirtual

post-job

empty method

Reimplemented from edm::EDProducer.

Definition at line 121 of file MuonSeedTrack.cc.

121  {
122 }
TrajectoryStateOnSurface MuonSeedTrack::getSeedTSOS ( const TrajectorySeed seed) const
private

get the TrajectorySeed's TrajectoryStateOnSurface

Get the TrajectoryStateOnSurface from the TrajectorySeed

Definition at line 128 of file MuonSeedTrack.cc.

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

128  {
129 
130  // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
131  PTrajectoryStateOnDet pTSOD = seed.startingState();
132 
133  // Transform it in a TrajectoryStateOnSurface
134 
135 
136  DetId seedDetId(pTSOD.detId());
137 
138  const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
139 
140  TrajectoryStateOnSurface initialState = trajectoryStateTransform::transientState(pTSOD, &(gdet->surface()), &*theService->magneticField());
141 
142  /*
143  // Get the layer on which the seed relies
144  const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
145 
146  PropagationDirection detLayerOrder = oppositeToMomentum;
147 
148  // ask for compatible layers
149  vector<const DetLayer*> detLayers;
150  detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder);
151 
152  TrajectoryStateOnSurface result = initialState;
153  if(detLayers.size()){
154  const DetLayer* finalLayer = detLayers.back();
155  const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface());
156  if(propagatedState.isValid())
157  result = propagatedState;
158  }
159 
160  return result;
161  */
162 
163  return initialState;
164 
165 }
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: MuonSeedTrack.h:79
unsigned int detId() const
Definition: DetId.h:20
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
void MuonSeedTrack::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
privatevirtual

construct proto-tracks

For each seed, make a (fake) reco::Track

Implements edm::EDProducer.

Definition at line 78 of file MuonSeedTrack.cc.

79 {
80  using namespace edm;
81 
82  // Update the services
83  theService->update(eventSetup);
84 
85  // the track collectios; they will be loaded in the event
86  auto_ptr<reco::TrackCollection> trackCollection(new reco::TrackCollection());
87  // ... and its reference into the event
88  reco::TrackRefProd trackCollectionRefProd = event.getRefBeforePut<reco::TrackCollection>();
89 
90 
92  event.getByLabel(theSeedsLabel, seeds);
93 
94  for ( TrajectorySeedCollection::const_iterator iSeed = seeds->begin();
95  iSeed != seeds->end(); iSeed++ ) {
96  pair<bool,reco::Track> resultOfTrackExtrapAtPCA = buildTrackAtPCA(*iSeed);
97  if(!resultOfTrackExtrapAtPCA.first) continue;
98  // take the "bare" track at PCA
99  reco::Track &track = resultOfTrackExtrapAtPCA.second;
100  // fill the TrackCollection
101  trackCollection->push_back(track);
102  }
103 
104  event.put(trackCollection);
105 
106 }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: MuonSeedTrack.h:79
std::pair< bool, reco::Track > buildTrackAtPCA(const TrajectorySeed &) const
Build a track at the PCA WITHOUT any vertex constriant.
edm::InputTag theSeedsLabel
the propagator used for extracting TSOS from seed
Definition: MuonSeedTrack.h:91
void MuonSeedTrack::setAlias ( std::string  alias)
inlineprivate

set the Branch alias

Definition at line 65 of file MuonSeedTrack.h.

References theAlias.

65  {
66  alias.erase( alias.size() - 1, alias.size() );
67  theAlias=alias;
68  }
std::string theAlias
the Branch alias
Definition: MuonSeedTrack.h:85

Member Data Documentation

std::string MuonSeedTrack::theAlias
private

the Branch alias

Definition at line 85 of file MuonSeedTrack.h.

Referenced by setAlias().

bool MuonSeedTrack::theAllowNoVtxFlag
private

Definition at line 94 of file MuonSeedTrack.h.

edm::InputTag MuonSeedTrack::theSeedsLabel
private

the propagator used for extracting TSOS from seed

the TrajectorySeed label

Definition at line 91 of file MuonSeedTrack.h.

MuonServiceProxy* MuonSeedTrack::theService
private

the event setup proxy, it takes care the services update

Definition at line 79 of file MuonSeedTrack.h.

MuonUpdatorAtVertex* MuonSeedTrack::theUpdatorAtVtx
private

the class used for updating a Trajectory State at veretex

Definition at line 82 of file MuonSeedTrack.h.