CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CSCOverlapsTrackPreparation Class Reference

#include <Alignment/CSCOverlapsTrackPreparation/src/CSCOverlapsTrackPreparation.cc>

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

Public Member Functions

 CSCOverlapsTrackPreparation (const edm::ParameterSet &)
 
 ~CSCOverlapsTrackPreparation () override
 
- 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
 
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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 Types

enum  { kNothing, kSimpleFit, kAllButOne, kExtrapolate }
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag m_src
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 62 of file CSCOverlapsTrackPreparation.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kNothing 
kSimpleFit 
kAllButOne 
kExtrapolate 

Definition at line 68 of file CSCOverlapsTrackPreparation.cc.

Constructor & Destructor Documentation

◆ CSCOverlapsTrackPreparation()

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

Definition at line 89 of file CSCOverlapsTrackPreparation.cc.

90  : m_src(iConfig.getParameter<edm::InputTag>("src")) {
91  produces<std::vector<Trajectory>>();
92  produces<TrajTrackAssociationCollection>();
93 }

◆ ~CSCOverlapsTrackPreparation()

CSCOverlapsTrackPreparation::~CSCOverlapsTrackPreparation ( )
override

Definition at line 95 of file CSCOverlapsTrackPreparation.cc.

95  {
96  // do anything here that needs to be done at desctruction time
97  // (e.g. close files, deallocate resources etc.)
98 }

Member Function Documentation

◆ beginJob()

void CSCOverlapsTrackPreparation::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 205 of file CSCOverlapsTrackPreparation.cc.

205 {}

◆ endJob()

void CSCOverlapsTrackPreparation::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 208 of file CSCOverlapsTrackPreparation.cc.

208 {}

Referenced by o2olib.O2ORunMgr::executeJob().

◆ produce()

void CSCOverlapsTrackPreparation::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 105 of file CSCOverlapsTrackPreparation.cc.

105  {
107  iEvent.getByLabel(m_src, tracks);
108 
109  edm::ESHandle<CSCGeometry> cscGeometry;
110  iSetup.get<MuonGeometryRecord>().get(cscGeometry);
111 
114 
116  iSetup.get<GlobalTrackingGeometryRecord>().get(globalGeometry);
117 
118  MuonTransientTrackingRecHitBuilder muonTransBuilder;
119 
120  // Create a collection of Trajectories, to put in the Event
121  auto trajectoryCollection = std::make_unique<std::vector<Trajectory>>();
122 
123  // Remember which trajectory is associated with which track
124  std::map<edm::Ref<std::vector<Trajectory>>::key_type, edm::Ref<reco::TrackCollection>::key_type> reference_map;
125  edm::Ref<std::vector<Trajectory>>::key_type trajCounter = 0;
127 
128  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) {
129  trackCounter++;
130 
131  // now we'll actually put hits on the new trajectory
132  // these must be in lock-step
134  std::vector<TrajectoryMeasurement::ConstRecHitPointer> transHits;
135  std::vector<TrajectoryStateOnSurface> TSOSes;
136 
137  for (auto const& hit : track->recHits()) {
138  DetId id = hit->geographicalId();
139  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
140  const Surface& layerSurface = cscGeometry->idToDet(id)->surface();
141  TrajectoryMeasurement::ConstRecHitPointer hitPtr(muonTransBuilder.build(hit, globalGeometry));
142 
143  AlgebraicVector5 params; // meaningless, CSCOverlapsAlignmentAlgorithm does the fit internally
144  params[0] = 1.; // straight-forward direction
145  params[1] = 0.;
146  params[2] = 0.;
147  params[3] = 0.; // center of the chamber
148  params[4] = 0.;
149  LocalTrajectoryParameters localTrajectoryParameters(params, 1., false);
150  LocalTrajectoryError localTrajectoryError(0.001, 0.001, 0.001, 0.001, 0.001);
151 
152  // these must be in lock-step
153  clonedHits.push_back(hit->clone());
154  transHits.push_back(hitPtr);
155  TSOSes.push_back(
156  TrajectoryStateOnSurface(localTrajectoryParameters, localTrajectoryError, layerSurface, &*magneticField));
157  } // end if CSC
158  } // end loop over hits
159 
160  assert(clonedHits.size() == transHits.size());
161  assert(transHits.size() == TSOSes.size());
162 
163  // build the trajectory
164  if (!clonedHits.empty()) {
165  PTrajectoryStateOnDet const PTraj =
166  trajectoryStateTransform::persistentState(*(TSOSes.begin()), clonedHits.begin()->geographicalId().rawId());
167  TrajectorySeed trajectorySeed(PTraj, clonedHits, alongMomentum);
168  Trajectory trajectory(trajectorySeed, alongMomentum);
169 
170  edm::OwnVector<TrackingRecHit>::const_iterator clonedHit = clonedHits.begin();
171  std::vector<TrajectoryMeasurement::ConstRecHitPointer>::const_iterator transHitPtr = transHits.begin();
172  std::vector<TrajectoryStateOnSurface>::const_iterator TSOS = TSOSes.begin();
173  for (; clonedHit != clonedHits.end(); ++clonedHit, ++transHitPtr, ++TSOS) {
174  trajectory.push(TrajectoryMeasurement(*TSOS, *TSOS, *TSOS, (*transHitPtr)));
175  }
176 
177  trajectoryCollection->push_back(trajectory);
178 
179  // Remember which Trajectory is associated with which Track
180  trajCounter++;
181  reference_map[trajCounter] = trackCounter;
182 
183  } // end if there are any clonedHits/TSOSes to work with
184  } // end loop over tracks
185 
186  unsigned int numTrajectories = trajectoryCollection->size();
187 
188  // insert the trajectories into the Event
189  edm::OrphanHandle<std::vector<Trajectory>> ohTrajs = iEvent.put(std::move(trajectoryCollection));
190 
191  // create the trajectory <-> track association map
192  auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
193 
194  for (trajCounter = 0; trajCounter < numTrajectories; trajCounter++) {
195  edm::Ref<reco::TrackCollection>::key_type trackCounter = reference_map[trajCounter];
196 
197  trajTrackMap->insert(edm::Ref<std::vector<Trajectory>>(ohTrajs, trajCounter),
198  edm::Ref<reco::TrackCollection>(tracks, trackCounter));
199  }
200  // and put it in the Event, also
201  iEvent.put(std::move(trajTrackMap));
202 }

References alongMomentum, cms::cuda::assert(), edm::OwnVector< T, P >::begin(), MuonTransientTrackingRecHitBuilder::build(), MuonSubdetId::CSC, edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), edm::EventSetup::get(), get, CSCGeometry::idToDet(), iEvent, m_src, HLT_FULL_cff::magneticField, eostools::move(), DetId::Muon, CalibrationSummaryClient_cfi::params, trajectoryStateTransform::persistentState(), Trajectory::push(), edm::OwnVector< T, P >::push_back(), edm::OwnVector< T, P >::size(), GeomDet::surface(), HLT_FULL_cff::track, and PDWG_EXOHSCP_cff::tracks.

Member Data Documentation

◆ m_src

edm::InputTag CSCOverlapsTrackPreparation::m_src
private

Definition at line 75 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
CSCGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91
cms::cuda::assert
assert(be >=bs)
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
Surface
Definition: Surface.h:36
CSCOverlapsTrackPreparation::kNothing
Definition: CSCOverlapsTrackPreparation.cc:68
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::Handle< reco::TrackCollection >
edm::Ref
Definition: AssociativeIterator.h:58
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
DetId
Definition: DetId.h:17
edm::OwnVector::empty
bool empty() const
Definition: OwnVector.h:305
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
edm::ESHandle< CSCGeometry >
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
LocalTrajectoryError
Definition: LocalTrajectoryError.h:20
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonTransientTrackingRecHitBuilder::build
RecHitPointer build(const TrackingRecHit *p, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
Call the MuonTransientTrackingRecHit::specificBuild.
Definition: MuonTransientTrackingRecHitBuilder.cc:20
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
get
#define get
CSCOverlapsTrackPreparation::kSimpleFit
Definition: CSCOverlapsTrackPreparation.cc:68
edm::Ref::key_type
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
TrajectoryMeasurement::ConstRecHitPointer
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Definition: TrajectoryMeasurement.h:28
Trajectory
Definition: Trajectory.h:38
CSCOverlapsTrackPreparation::kAllButOne
Definition: CSCOverlapsTrackPreparation.cc:68
TrajectorySeed
Definition: TrajectorySeed.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
DetId::Muon
Definition: DetId.h:26
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
MuonTransientTrackingRecHitBuilder
Definition: MuonTransientTrackingRecHitBuilder.h:12
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
edm::OwnVector::size
size_type size() const
Definition: OwnVector.h:300
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
TSOS
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
CSCOverlapsTrackPreparation::m_src
edm::InputTag m_src
Definition: CSCOverlapsTrackPreparation.cc:75
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >
CSCOverlapsTrackPreparation::kExtrapolate
Definition: CSCOverlapsTrackPreparation.cc:68