CMS 3D CMS Logo

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

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

Inheritance diagram for CSCOverlapsTrackPreparation:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CSCOverlapsTrackPreparation (const edm::ParameterSet &)
 
 ~CSCOverlapsTrackPreparation () override=default
 
- 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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

const edm::ESGetToken< CSCGeometry, MuonGeometryRecordcscGeomToken_
 
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordglobalGeomToken_
 
const edm::InputTag m_src
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
const edm::EDGetTokenT< reco::TrackCollectiontrackToken_
 

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
 
- 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

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

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

Definition at line 63 of file CSCOverlapsTrackPreparation.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ CSCOverlapsTrackPreparation()

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

Definition at line 96 of file CSCOverlapsTrackPreparation.cc.

97  : m_src(iConfig.getParameter<edm::InputTag>("src")),
98  cscGeomToken_(esConsumes<edm::Transition::BeginRun>()),
99  magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()),
100  globalGeomToken_(esConsumes<edm::Transition::BeginRun>()),
101  trackToken_(consumes<reco::TrackCollection>(m_src)) {
102  produces<std::vector<Trajectory>>();
103  produces<TrajTrackAssociationCollection>();
104 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeomToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globalGeomToken_
const edm::EDGetTokenT< reco::TrackCollection > trackToken_

◆ ~CSCOverlapsTrackPreparation()

CSCOverlapsTrackPreparation::~CSCOverlapsTrackPreparation ( )
overridedefault

Member Function Documentation

◆ beginJob()

void CSCOverlapsTrackPreparation::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 210 of file CSCOverlapsTrackPreparation.cc.

210 {}

◆ endJob()

void CSCOverlapsTrackPreparation::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 213 of file CSCOverlapsTrackPreparation.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

213 {}

◆ fillDescriptions()

void CSCOverlapsTrackPreparation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 109 of file CSCOverlapsTrackPreparation.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

109  {
111  desc.add<edm::InputTag>("src", edm::InputTag("ALCARECOMuAlBeamHaloOverlaps"));
112  descriptions.add("cscOverlapsTrackPreparation", desc);
113 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 116 of file CSCOverlapsTrackPreparation.cc.

References alongMomentum, cms::cuda::assert(), edm::OwnVector< T, P >::begin(), MuonTransientTrackingRecHitBuilder::build(), MuonSubdetId::CSC, cscGeomToken_, edm::OwnVector< T, P >::empty(), edm::OwnVector< T, P >::end(), edm::EventSetup::getData(), globalGeomToken_, CSCGeometry::idToDet(), iEvent, HLT_2024v10_cff::magneticField, magneticFieldToken_, eostools::move(), DetId::Muon, submitPVValidationJobs::params, trajectoryStateTransform::persistentState(), Trajectory::push(), edm::OwnVector< T, P >::push_back(), edm::OwnVector< T, P >::size(), GeomDet::surface(), HLT_2024v10_cff::track, DiMuonV_cfg::tracks, and trackToken_.

116  {
118 
119  const CSCGeometry* cscGeometry = &iSetup.getData(cscGeomToken_);
121  const GlobalTrackingGeometry* globalGeometry = &iSetup.getData(globalGeomToken_);
122 
123  MuonTransientTrackingRecHitBuilder muonTransBuilder;
124 
125  // Create a collection of Trajectories, to put in the Event
126  auto trajectoryCollection = std::make_unique<std::vector<Trajectory>>();
127 
128  // Remember which trajectory is associated with which track
129  std::map<edm::Ref<std::vector<Trajectory>>::key_type, edm::Ref<reco::TrackCollection>::key_type> reference_map;
130  edm::Ref<std::vector<Trajectory>>::key_type trajCounter = 0;
132 
133  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) {
134  trackCounter++;
135 
136  // now we'll actually put hits on the new trajectory
137  // these must be in lock-step
139  std::vector<TrajectoryMeasurement::ConstRecHitPointer> transHits;
140  std::vector<TrajectoryStateOnSurface> TSOSes;
141 
142  for (auto const& hit : track->recHits()) {
143  DetId id = hit->geographicalId();
144  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
145  const Surface& layerSurface = cscGeometry->idToDet(id)->surface();
146  TrajectoryMeasurement::ConstRecHitPointer hitPtr(muonTransBuilder.build(hit, globalGeometry));
147 
148  AlgebraicVector5 params; // meaningless, CSCOverlapsAlignmentAlgorithm does the fit internally
149  params[0] = 1.; // straight-forward direction
150  params[1] = 0.;
151  params[2] = 0.;
152  params[3] = 0.; // center of the chamber
153  params[4] = 0.;
154  LocalTrajectoryParameters localTrajectoryParameters(params, 1., false);
155  LocalTrajectoryError localTrajectoryError(0.001, 0.001, 0.001, 0.001, 0.001);
156 
157  // these must be in lock-step
158  clonedHits.push_back(hit->clone());
159  transHits.push_back(hitPtr);
160  TSOSes.push_back(
161  TrajectoryStateOnSurface(localTrajectoryParameters, localTrajectoryError, layerSurface, &*magneticField));
162  } // end if CSC
163  } // end loop over hits
164 
165  assert(clonedHits.size() == transHits.size());
166  assert(transHits.size() == TSOSes.size());
167 
168  // build the trajectory
169  if (!clonedHits.empty()) {
170  PTrajectoryStateOnDet const PTraj =
171  trajectoryStateTransform::persistentState(*(TSOSes.begin()), clonedHits.begin()->geographicalId().rawId());
172  TrajectorySeed trajectorySeed(PTraj, clonedHits, alongMomentum);
173  Trajectory trajectory(trajectorySeed, alongMomentum);
174 
175  edm::OwnVector<TrackingRecHit>::const_iterator clonedHit = clonedHits.begin();
176  std::vector<TrajectoryMeasurement::ConstRecHitPointer>::const_iterator transHitPtr = transHits.begin();
177  std::vector<TrajectoryStateOnSurface>::const_iterator TSOS = TSOSes.begin();
178  for (; clonedHit != clonedHits.end(); ++clonedHit, ++transHitPtr, ++TSOS) {
179  trajectory.push(TrajectoryMeasurement(*TSOS, *TSOS, *TSOS, (*transHitPtr)));
180  }
181 
182  trajectoryCollection->push_back(trajectory);
183 
184  // Remember which Trajectory is associated with which Track
185  trajCounter++;
186  reference_map[trajCounter] = trackCounter;
187 
188  } // end if there are any clonedHits/TSOSes to work with
189  } // end loop over tracks
190 
191  unsigned int numTrajectories = trajectoryCollection->size();
192 
193  // insert the trajectories into the Event
194  edm::OrphanHandle<std::vector<Trajectory>> ohTrajs = iEvent.put(std::move(trajectoryCollection));
195 
196  // create the trajectory <-> track association map
197  auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
198 
199  for (trajCounter = 0; trajCounter < numTrajectories; trajCounter++) {
200  edm::Ref<reco::TrackCollection>::key_type trackCounter = reference_map[trajCounter];
201 
202  trajTrackMap->insert(edm::Ref<std::vector<Trajectory>>(ohTrajs, trajCounter),
203  edm::Ref<reco::TrackCollection>(tracks, trackCounter));
204  }
205  // and put it in the Event, also
206  iEvent.put(std::move(trajTrackMap));
207 }
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeomToken_
assert(be >=bs)
iterator begin()
Definition: OwnVector.h:280
RecHitPointer build(const TrackingRecHit *p, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
Call the MuonTransientTrackingRecHit::specificBuild.
void push_back(D *&d)
Definition: OwnVector.h:326
int iEvent
Definition: GenABIO.cc:224
size_type size() const
Definition: OwnVector.h:300
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: DetId.h:17
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
iterator end()
Definition: OwnVector.h:285
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globalGeomToken_
bool empty() const
Definition: OwnVector.h:305
const edm::EDGetTokenT< reco::TrackCollection > trackToken_
static constexpr int CSC
Definition: MuonSubdetId.h:12
def move(src, dest)
Definition: eostools.py:511
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91

Member Data Documentation

◆ cscGeomToken_

const edm::ESGetToken<CSCGeometry, MuonGeometryRecord> CSCOverlapsTrackPreparation::cscGeomToken_
private

Definition at line 79 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

◆ globalGeomToken_

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> CSCOverlapsTrackPreparation::globalGeomToken_
private

Definition at line 81 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

◆ m_src

const edm::InputTag CSCOverlapsTrackPreparation::m_src
private

Definition at line 77 of file CSCOverlapsTrackPreparation.cc.

◆ magneticFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CSCOverlapsTrackPreparation::magneticFieldToken_
private

Definition at line 80 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

◆ trackToken_

const edm::EDGetTokenT<reco::TrackCollection> CSCOverlapsTrackPreparation::trackToken_
private

Definition at line 82 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().