CMS 3D CMS Logo

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 () override
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 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...
 
void endJob () override
 post-job More...
 
TrajectoryStateOnSurface getSeedTSOS (const TrajectorySeed &seed) const
 get the TrajectorySeed's TrajectoryStateOnSurface More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 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< TrajectorySeedCollectiontheSeedsToken
 
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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 46 of file MuonSeedTrack.h.

Constructor & Destructor Documentation

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

constructor with config

Definition at line 38 of file MuonSeedTrack.cc.

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

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

destructor

Definition at line 59 of file MuonSeedTrack.cc.

59  {
60  if (theService)
61  delete theService;
62  if (theUpdatorAtVtx)
63  delete theUpdatorAtVtx;
64 }
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: MuonSeedTrack.h:82
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:85

Member Function Documentation

void MuonSeedTrack::beginJob ( void  )
overrideprivatevirtual

pre-job booking

empty method

Reimplemented from edm::EDProducer.

Definition at line 103 of file MuonSeedTrack.cc.

103 {}
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 154 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(), HLT_2018_cff::track, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

154  {
155  const string metname = "MuonSeedTrack";
156 
158 
159  TSOS seedTSOS = getSeedTSOS(seed);
160  // This is needed to extrapolate the tsos at vertex
161  LogTrace(metname) << "Propagate to PCA...";
162  pair<bool, FreeTrajectoryState> extrapolationResult = theUpdatorAtVtx->propagateToNominalLine(seedTSOS);
163  FreeTrajectoryState ftsAtVtx;
164 
165  if (extrapolationResult.first) {
166  ftsAtVtx = extrapolationResult.second;
167  } else {
168  if (TrackerBounds::isInside(seedTSOS.globalPosition())) {
169  LogWarning(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
170  ftsAtVtx = *seedTSOS.freeState();
171  } else {
172  if (theAllowNoVtxFlag) {
173  LogWarning(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
174  ftsAtVtx = *seedTSOS.freeState();
175  } else {
176  LogWarning(metname) << "Stand Alone track: this track will be rejected";
177  return pair<bool, reco::Track>(false, reco::Track());
178  }
179  }
180  }
181 
182  LogTrace(metname) << "TSOS after the extrapolation at vtx";
183  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
184 
185  GlobalPoint pca = ftsAtVtx.position();
186  math::XYZPoint persistentPCA(pca.x(), pca.y(), pca.z());
187  GlobalVector p = ftsAtVtx.momentum();
188  math::XYZVector persistentMomentum(p.x(), p.y(), p.z());
189 
190  double dummyNDOF = 1.0;
191  //double ndof = computeNDOF(seed);
192  double dummyChi2 = 1.0;
193 
195  dummyChi2, dummyNDOF, persistentPCA, persistentMomentum, ftsAtVtx.charge(), ftsAtVtx.curvilinearError());
196 
197  return pair<bool, reco::Track>(true, track);
198 }
static bool isInside(const GlobalPoint &)
const std::string metname
T y() const
Definition: PV3DBase.h:60
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:61
GlobalVector momentum() const
#define LogTrace(id)
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:85
GlobalPoint position() const
#define debug
Definition: HDRShower.cc:19
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
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:98
T x() const
Definition: PV3DBase.h:59
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 203 of file MuonSeedTrack.cc.

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

203  {
204  const string metname = "MuonSeedTrack";
205 
206  BasicTrajectorySeed::const_iterator recHits1 = (trajectory.recHits().first);
207  BasicTrajectorySeed::const_iterator recHits2 = (trajectory.recHits().second);
208 
209  double ndof = 0.;
210 
211  if ((*recHits1).isValid())
212  ndof += (*recHits1).dimension();
213  if ((*recHits2).isValid())
214  ndof += (*recHits2).dimension();
215 
216  //const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
217  //for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
218  // rechit != transRecHits.end(); ++rechit)
219  //if ((*rechit)->isValid()) ndof += (*rechit)->dimension();
220 
221  // FIXME! in case of Boff is dof - 4
222  return max(ndof - 5., 0.);
223 }
const std::string metname
recHitContainer::const_iterator const_iterator
range recHits() const
void MuonSeedTrack::endJob ( void  )
overrideprivatevirtual

post-job

empty method

Reimplemented from edm::EDProducer.

Definition at line 108 of file MuonSeedTrack.cc.

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

get the TrajectorySeed's TrajectoryStateOnSurface

Get the TrajectoryStateOnSurface from the TrajectorySeed

Definition at line 113 of file MuonSeedTrack.cc.

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

113  {
114  // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
115  PTrajectoryStateOnDet pTSOD = seed.startingState();
116 
117  // Transform it in a TrajectoryStateOnSurface
118 
119  DetId seedDetId(pTSOD.detId());
120 
121  const GeomDet* gdet = theService->trackingGeometry()->idToDet(seedDetId);
122 
123  TrajectoryStateOnSurface initialState =
124  trajectoryStateTransform::transientState(pTSOD, &(gdet->surface()), &*theService->magneticField());
125 
126  /*
127  // Get the layer on which the seed relies
128  const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
129 
130  PropagationDirection detLayerOrder = oppositeToMomentum;
131 
132  // ask for compatible layers
133  vector<const DetLayer*> detLayers;
134  detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder);
135 
136  TrajectoryStateOnSurface result = initialState;
137  if(detLayers.size()){
138  const DetLayer* finalLayer = detLayers.back();
139  const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface());
140  if(propagatedState.isValid())
141  result = propagatedState;
142  }
143 
144  return result;
145  */
146 
147  return initialState;
148 }
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: MuonSeedTrack.h:82
unsigned int detId() const
Definition: DetId.h:17
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 
)
overrideprivate

construct proto-tracks

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

Definition at line 73 of file MuonSeedTrack.cc.

References eostools::move(), HLT_2018_cff::track, and duplicaterechits_cfi::trackCollection.

73  {
74  using namespace edm;
75 
76  // Update the services
77  theService->update(eventSetup);
78 
79  // the track collectios; they will be loaded in the event
80  unique_ptr<reco::TrackCollection> trackCollection(new reco::TrackCollection());
81  // ... and its reference into the event
82  reco::TrackRefProd trackCollectionRefProd = event.getRefBeforePut<reco::TrackCollection>();
83 
85  event.getByToken(theSeedsToken, seeds);
86 
87  for (TrajectorySeedCollection::const_iterator iSeed = seeds->begin(); iSeed != seeds->end(); iSeed++) {
88  pair<bool, reco::Track> resultOfTrackExtrapAtPCA = buildTrackAtPCA(*iSeed);
89  if (!resultOfTrackExtrapAtPCA.first)
90  continue;
91  // take the "bare" track at PCA
92  reco::Track& track = resultOfTrackExtrapAtPCA.second;
93  // fill the TrackCollection
94  trackCollection->push_back(track);
95  }
96 
97  event.put(std::move(trackCollection));
98 }
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:82
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:95
HLT enums.
def move(src, dest)
Definition: eostools.py:511
void MuonSeedTrack::setAlias ( std::string  alias)
inlineprivate

set the Branch alias

Definition at line 68 of file MuonSeedTrack.h.

References SiStripOfflineCRack_cfg::alias.

68  {
69  alias.erase(alias.size() - 1, alias.size());
70  theAlias = alias;
71  }
std::string theAlias
the Branch alias
Definition: MuonSeedTrack.h:88

Member Data Documentation

std::string MuonSeedTrack::theAlias
private

the Branch alias

Definition at line 88 of file MuonSeedTrack.h.

bool MuonSeedTrack::theAllowNoVtxFlag
private

Definition at line 98 of file MuonSeedTrack.h.

edm::InputTag MuonSeedTrack::theSeedsLabel
private

the propagator used for extracting TSOS from seed

the TrajectorySeed label

Definition at line 94 of file MuonSeedTrack.h.

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

Definition at line 95 of file MuonSeedTrack.h.

MuonServiceProxy* MuonSeedTrack::theService
private

the event setup proxy, it takes care the services update

Definition at line 82 of file MuonSeedTrack.h.

MuonUpdatorAtVertex* MuonSeedTrack::theUpdatorAtVtx
private

the class used for updating a Trajectory State at veretex

Definition at line 85 of file MuonSeedTrack.h.