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

#include <MuonSeedTrack.h>

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

Public Member Functions

 MuonSeedTrack (const edm::ParameterSet &)
 constructor with config More...
 
 ~MuonSeedTrack ()
 destructor More...
 
- 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 ()
 

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...
 
edm::EDGetTokenT
< TrajectorySeedCollection
theSeedsToken
 
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
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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

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

Author
Adam Everett Purdue University

Definition at line 45 of file MuonSeedTrack.h.

Constructor & Destructor Documentation

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

constructor with config

Definition at line 39 of file MuonSeedTrack.cc.

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

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

destructor

Definition at line 62 of file MuonSeedTrack.cc.

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

Member Function Documentation

void MuonSeedTrack::beginJob ( void  )
privatevirtual

pre-job booking

empty method

Reimplemented from edm::EDProducer.

Definition at line 110 of file MuonSeedTrack.cc.

111 {
112 }
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 170 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().

170  {
171 
172  const string metname = "MuonSeedTrack";
173 
175 
176  TSOS seedTSOS = getSeedTSOS(seed);
177  // This is needed to extrapolate the tsos at vertex
178  LogTrace(metname) << "Propagate to PCA...";
179  pair<bool,FreeTrajectoryState>
180  extrapolationResult = theUpdatorAtVtx->propagateToNominalLine(seedTSOS);
181  FreeTrajectoryState ftsAtVtx;
182 
183  if(extrapolationResult.first) {
184  ftsAtVtx = extrapolationResult.second;
185  } else {
186  if(TrackerBounds::isInside(seedTSOS.globalPosition())){
187  LogWarning(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
188  ftsAtVtx = *seedTSOS.freeState();
189  }
190  else{
191  if ( theAllowNoVtxFlag ) {
192  LogWarning(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
193  ftsAtVtx = *seedTSOS.freeState();
194  } else {
195  LogWarning(metname) << "Stand Alone track: this track will be rejected";
196  return pair<bool,reco::Track>(false,reco::Track());
197  }
198  }
199  }
200 
201  LogTrace(metname) << "TSOS after the extrapolation at vtx";
202  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
203 
204  GlobalPoint pca = ftsAtVtx.position();
205  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
206  GlobalVector p = ftsAtVtx.momentum();
207  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
208 
209  double dummyNDOF = 1.0;
210  //double ndof = computeNDOF(seed);
211  double dummyChi2 = 1.0;
212 
213  reco::Track track(dummyChi2,
214  dummyNDOF,
215  persistentPCA,
216  persistentMomentum,
217  ftsAtVtx.charge(),
218  ftsAtVtx.curvilinearError());
219 
220  return pair<bool,reco::Track>(true,track);
221 }
static bool isInside(const GlobalPoint &)
const std::string metname
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
#define LogTrace(id)
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:84
GlobalPoint position() const
#define debug
Definition: HDRShower.cc:19
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
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed) const
get the TrajectorySeed&#39;s TrajectoryStateOnSurface
bool theAllowNoVtxFlag
Definition: MuonSeedTrack.h:97
T x() const
Definition: PV3DBase.h:62
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 226 of file MuonSeedTrack.cc.

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

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

post-job

empty method

Reimplemented from edm::EDProducer.

Definition at line 119 of file MuonSeedTrack.cc.

119  {
120 }
TrajectoryStateOnSurface MuonSeedTrack::getSeedTSOS ( const TrajectorySeed seed) const
private

get the TrajectorySeed's TrajectoryStateOnSurface

Get the TrajectoryStateOnSurface from the TrajectorySeed

Definition at line 126 of file MuonSeedTrack.cc.

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

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

References HLT_25ns14e33_v3_cff::trackCollection.

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

set the Branch alias

Definition at line 67 of file MuonSeedTrack.h.

References HLT_25ns14e33_v1_cff::alias, and theAlias.

67  {
68  alias.erase( alias.size() - 1, alias.size() );
70  }
std::string theAlias
the Branch alias
Definition: MuonSeedTrack.h:87

Member Data Documentation

std::string MuonSeedTrack::theAlias
private

the Branch alias

Definition at line 87 of file MuonSeedTrack.h.

Referenced by setAlias().

bool MuonSeedTrack::theAllowNoVtxFlag
private

Definition at line 97 of file MuonSeedTrack.h.

edm::InputTag MuonSeedTrack::theSeedsLabel
private

the propagator used for extracting TSOS from seed

the TrajectorySeed label

Definition at line 93 of file MuonSeedTrack.h.

edm::EDGetTokenT<TrajectorySeedCollection> MuonSeedTrack::theSeedsToken
private

Definition at line 94 of file MuonSeedTrack.h.

MuonServiceProxy* MuonSeedTrack::theService
private

the event setup proxy, it takes care the services update

Definition at line 81 of file MuonSeedTrack.h.

MuonUpdatorAtVertex* MuonSeedTrack::theUpdatorAtVtx
private

the class used for updating a Trajectory State at veretex

Definition at line 84 of file MuonSeedTrack.h.