CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CSCOverlapsTrackPreparation (const edm::ParameterSet &)
 
 ~CSCOverlapsTrackPreparation () override
 
- 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
 
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
 
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::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
 
bool registeredToConsumeMany (TypeID const &, 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::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

const edm::ESGetToken
< CSCGeometry,
MuonGeometryRecord
cscGeomToken_
 
const edm::ESGetToken
< GlobalTrackingGeometry,
GlobalTrackingGeometryRecord
globalGeomToken_
 
edm::InputTag m_src
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
magneticFieldToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase 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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (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 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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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 62 of file CSCOverlapsTrackPreparation.cc.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

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

Definition at line 93 of file CSCOverlapsTrackPreparation.cc.

94  : m_src(iConfig.getParameter<edm::InputTag>("src")),
95  cscGeomToken_(esConsumes<edm::Transition::BeginRun>()),
96  magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()),
97  globalGeomToken_(esConsumes<edm::Transition::BeginRun>()) {
98  produces<std::vector<Trajectory>>();
99  produces<TrajTrackAssociationCollection>();
100 }
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeomToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globalGeomToken_
CSCOverlapsTrackPreparation::~CSCOverlapsTrackPreparation ( )
override

Definition at line 102 of file CSCOverlapsTrackPreparation.cc.

102  {
103  // do anything here that needs to be done at desctruction time
104  // (e.g. close files, deallocate resources etc.)
105 }

Member Function Documentation

void CSCOverlapsTrackPreparation::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 207 of file CSCOverlapsTrackPreparation.cc.

207 {}
void CSCOverlapsTrackPreparation::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 210 of file CSCOverlapsTrackPreparation.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

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

Implements edm::one::EDProducerBase.

Definition at line 112 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::Event::getByLabel(), edm::EventSetup::getData(), globalGeomToken_, CSCGeometry::idToDet(), m_src, HLT_FULL_cff::magneticField, magneticFieldToken_, eostools::move(), DetId::Muon, submitPVValidationJobs::params, trajectoryStateTransform::persistentState(), Trajectory::push(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), edm::OwnVector< T, P >::size(), GeomDet::surface(), HLT_FULL_cff::track, and tracks.

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

Member Data Documentation

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

Definition at line 77 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

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

Definition at line 79 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

edm::InputTag CSCOverlapsTrackPreparation::m_src
private

Definition at line 75 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().

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

Definition at line 78 of file CSCOverlapsTrackPreparation.cc.

Referenced by produce().