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::one::EDProducer<> edm::one::EDProducerBase 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::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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...
 
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::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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::MuonSeedTrack ( const edm::ParameterSet pset)
explicit

constructor with config

Definition at line 39 of file MuonSeedTrack.cc.

References MuonServiceProxy_cff::MuonServiceProxy, MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

39  {
40  // service parameters
41  ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
42  theService = new MuonServiceProxy(serviceParameters, consumesCollector());
43 
44  ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
45  //theSeedPropagatorName = updatorPar.getParameter<string>("Propagator");
46  theSeedsLabel = pset.getParameter<InputTag>("MuonSeed");
47  theSeedsToken = consumes<TrajectorySeedCollection>(theSeedsLabel);
49 
50  theAllowNoVtxFlag = pset.getUntrackedParameter<bool>("AllowNoVertex", false);
51 
52  //register products
53  setAlias(pset.getParameter<std::string>("@module_label"));
54  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
55 }
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
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< TrajectorySeedCollection > theSeedsToken
Definition: MuonSeedTrack.h:92
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:82
bool theAllowNoVtxFlag
Definition: MuonSeedTrack.h:95
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:68

◆ ~MuonSeedTrack()

MuonSeedTrack::~MuonSeedTrack ( )
override

destructor

Definition at line 60 of file MuonSeedTrack.cc.

60  {
61  if (theService)
62  delete theService;
63  if (theUpdatorAtVtx)
64  delete theUpdatorAtVtx;
65 }
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

◆ beginJob()

void MuonSeedTrack::beginJob ( void  )
overrideprivatevirtual

pre-job booking

empty method

Reimplemented from edm::one::EDProducerBase.

Definition at line 104 of file MuonSeedTrack.cc.

104 {}

◆ buildTrackAtPCA()

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 155 of file MuonSeedTrack.cc.

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

155  {
156  const string metname = "MuonSeedTrack";
157 
159 
160  TSOS seedTSOS = getSeedTSOS(seed);
161  // This is needed to extrapolate the tsos at vertex
162  LogTrace(metname) << "Propagate to PCA...";
163  pair<bool, FreeTrajectoryState> extrapolationResult = theUpdatorAtVtx->propagateToNominalLine(seedTSOS);
164  FreeTrajectoryState ftsAtVtx;
165 
166  if (extrapolationResult.first) {
167  ftsAtVtx = extrapolationResult.second;
168  } else {
169  if (TrackerBounds::isInside(seedTSOS.globalPosition())) {
170  LogWarning(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
171  ftsAtVtx = *seedTSOS.freeState();
172  } else {
173  if (theAllowNoVtxFlag) {
174  LogWarning(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
175  ftsAtVtx = *seedTSOS.freeState();
176  } else {
177  LogWarning(metname) << "Stand Alone track: this track will be rejected";
178  return pair<bool, reco::Track>(false, reco::Track());
179  }
180  }
181  }
182 
183  LogTrace(metname) << "TSOS after the extrapolation at vtx";
184  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
185 
186  GlobalPoint pca = ftsAtVtx.position();
187  math::XYZPoint persistentPCA(pca.x(), pca.y(), pca.z());
188  GlobalVector p = ftsAtVtx.momentum();
189  math::XYZVector persistentMomentum(p.x(), p.y(), p.z());
190 
191  double dummyNDOF = 1.0;
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 CurvilinearTrajectoryError & curvilinearError() const
T z() const
Definition: PV3DBase.h:61
const std::string metname
#define LogTrace(id)
GlobalPoint position() const
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed) const
get the TrajectorySeed&#39;s TrajectoryStateOnSurface
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
std::pair< bool, FreeTrajectoryState > propagateToNominalLine(const TrajectoryStateOnSurface &tsos) const
Propagate the state to the 2D-PCA (nominal CMS axis)
TrackCharge charge() const
GlobalVector momentum() const
MuonUpdatorAtVertex * theUpdatorAtVtx
the class used for updating a Trajectory State at veretex
Definition: MuonSeedTrack.h:82
#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
bool theAllowNoVtxFlag
Definition: MuonSeedTrack.h:95
FreeTrajectoryState const * freeState(bool withErrors=true) const
Log< level::Warning, false > LogWarning

◆ endJob()

void MuonSeedTrack::endJob ( void  )
overrideprivatevirtual

post-job

empty method

Reimplemented from edm::one::EDProducerBase.

Definition at line 109 of file MuonSeedTrack.cc.

109 {}

◆ getSeedTSOS()

TrajectoryStateOnSurface MuonSeedTrack::getSeedTSOS ( const TrajectorySeed seed) const
private

get the TrajectorySeed's TrajectoryStateOnSurface

Get the TrajectoryStateOnSurface from the TrajectorySeed

Definition at line 114 of file MuonSeedTrack.cc.

References PTrajectoryStateOnDet::detId(), fileCollector::seed, and trajectoryStateTransform::transientState().

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

◆ produce()

void MuonSeedTrack::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
overrideprivatevirtual

construct proto-tracks

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

Implements edm::one::EDProducerBase.

Definition at line 74 of file MuonSeedTrack.cc.

References options_cfi::eventSetup, eostools::move(), HLT_FULL_cff::seeds, HLT_2023v12_cff::track, and JetHT_cfg::trackCollection.

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

◆ setAlias()

void MuonSeedTrack::setAlias ( std::string  alias)
inlineprivate

set the Branch alias

Definition at line 68 of file MuonSeedTrack.h.

References SiStripOfflineCRack_cfg::alias, and theAlias.

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

Member Data Documentation

◆ theAlias

std::string MuonSeedTrack::theAlias
private

the Branch alias

Definition at line 85 of file MuonSeedTrack.h.

Referenced by setAlias().

◆ theAllowNoVtxFlag

bool MuonSeedTrack::theAllowNoVtxFlag
private

Definition at line 95 of file MuonSeedTrack.h.

◆ theSeedsLabel

edm::InputTag MuonSeedTrack::theSeedsLabel
private

the propagator used for extracting TSOS from seed

the TrajectorySeed label

Definition at line 91 of file MuonSeedTrack.h.

◆ theSeedsToken

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

Definition at line 92 of file MuonSeedTrack.h.

◆ theService

MuonServiceProxy* MuonSeedTrack::theService
private

the event setup proxy, it takes care the services update

Definition at line 79 of file MuonSeedTrack.h.

◆ theUpdatorAtVtx

MuonUpdatorAtVertex* MuonSeedTrack::theUpdatorAtVtx
private

the class used for updating a Trajectory State at veretex

Definition at line 82 of file MuonSeedTrack.h.