CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CalibrationTrackSelectorFromDetIdList Class Referencefinal
Inheritance diagram for CalibrationTrackSelectorFromDetIdList:
edm::stream::EDProducer<>

Public Member Functions

 CalibrationTrackSelectorFromDetIdList (const edm::ParameterSet &)
 
 ~CalibrationTrackSelectorFromDetIdList () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
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
 

Private Member Functions

void beginRun (edm::Run const &run, const edm::EventSetup &) override
 
TrackCandidate makeCandidate (const reco::Track &tk, std::vector< const TrackingRecHit * >::iterator hitsBegin, std::vector< const TrackingRecHit * >::iterator hitsEnd)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< DetIdSelectordetidsels_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeometryToken_
 
edm::EDGetTokenT< reco::TrackCollectionm_label
 
bool m_verbose
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
edm::ESHandle< TrackerGeometrytheGeometry
 
edm::ESHandle< MagneticFieldtheMagField
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

CalibrationTrackSelectorFromDetIdList.cc Calibration/TkAlCaRecoProducers/plugins/CalibrationTrackSelectorFromDetIdList.cc Description: Selects tracks that have at leaast one valid hit on a given set of Tracker DetIds

Definition at line 44 of file CalibrationTrackSelectorFromDetIdList.cc.

Constructor & Destructor Documentation

◆ CalibrationTrackSelectorFromDetIdList()

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

Definition at line 67 of file CalibrationTrackSelectorFromDetIdList.cc.

68  : geometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>()),
69  magFieldToken_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
70  detidsels_() {
71  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet>>("selections");
72 
73  for (std::vector<edm::ParameterSet>::const_iterator selconfig = selconfigs.begin(); selconfig != selconfigs.end();
74  ++selconfig) {
75  DetIdSelector selection(*selconfig);
76  detidsels_.push_back(selection);
77  }
78 
79  m_verbose = iConfig.getUntrackedParameter<bool>("verbose");
80  m_label = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("Input"));
81  produces<TrackCandidateCollection>();
82 }

References detidsels_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_label, m_verbose, and corrVsCorr::selection.

◆ ~CalibrationTrackSelectorFromDetIdList()

CalibrationTrackSelectorFromDetIdList::~CalibrationTrackSelectorFromDetIdList ( )
override

Definition at line 84 of file CalibrationTrackSelectorFromDetIdList.cc.

84 {}

Member Function Documentation

◆ beginRun()

void CalibrationTrackSelectorFromDetIdList::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 161 of file CalibrationTrackSelectorFromDetIdList.cc.

161  {
164 
165  if (m_verbose) {
166  for (const auto &detidsel : detidsels_) {
167  auto theDetIds = theGeometry.product()->detIds();
168  for (const auto &theDet : theDetIds) {
169  if (detidsel.isSelected(theDet)) {
170  LogDebug("CalibrationTrackSelectorFromDetIdList") << "detid: " << theDet.rawId() << " is taken" << std::endl;
171  }
172  }
173  }
174  }
175 }

References TrackerGeometry::detIds(), detidsels_, geometryToken_, edm::EventSetup::getHandle(), LogDebug, m_verbose, magFieldToken_, edm::ESHandle< T >::product(), theGeometry, and theMagField.

◆ makeCandidate()

TrackCandidate CalibrationTrackSelectorFromDetIdList::makeCandidate ( const reco::Track tk,
std::vector< const TrackingRecHit * >::iterator  hitsBegin,
std::vector< const TrackingRecHit * >::iterator  hitsEnd 
)
private

Definition at line 129 of file CalibrationTrackSelectorFromDetIdList.cc.

132  {
135  if (pdir == anyDirection)
136  throw cms::Exception("UnimplementedFeature") << "Cannot work with tracks that have 'anyDirecton' \n";
137 
138  if ((pdir == alongMomentum) == ((tk.outerPosition() - tk.innerPosition()).Dot(tk.momentum()) >= 0)) {
139  // use inner state
140  TrajectoryStateOnSurface originalTsosIn(
143  } else {
144  // use outer state
145  TrajectoryStateOnSurface originalTsosOut(
148  }
151  ownHits.reserve(hitsEnd - hitsBegin);
152  for (; hitsBegin != hitsEnd; ++hitsBegin) {
153  ownHits.push_back((*hitsBegin)->clone());
154  }
155 
156  TrackCandidate cand(ownHits, seed, state, tk.seedRef());
157 
158  return cand;
159 }

References alongMomentum, anyDirection, Exception, reco::Track::innerDetId(), reco::Track::innerPosition(), trajectoryStateTransform::innerStateOnSurface(), reco::TrackBase::momentum(), reco::Track::outerDetId(), reco::Track::outerPosition(), trajectoryStateTransform::outerStateOnSurface(), trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), edm::OwnVector< T, P >::reserve(), fileCollector::seed, reco::Track::seedDirection(), reco::Track::seedRef(), theGeometry, and theMagField.

Referenced by produce().

◆ produce()

void CalibrationTrackSelectorFromDetIdList::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 91 of file CalibrationTrackSelectorFromDetIdList.cc.

91  {
92  using namespace edm;
93  using namespace std;
94 
95  edm::Handle<std::vector<reco::Track>> trackCollectionHandle;
96  iEvent.getByToken(m_label, trackCollectionHandle);
97  auto const &tracks = *trackCollectionHandle;
98 
99  auto output = std::make_unique<TrackCandidateCollection>();
100 
101  // loop on tracks
102  for (auto &trk : tracks) {
103  std::vector<const TrackingRecHit *> hits;
104 
105  bool saveTrack(false);
106 
107  for (auto const &hit : trk.recHits()) {
108  DetId detid = hit->geographicalId();
109 
110  for (const auto &detidsel : detidsels_) {
111  if (detidsel.isSelected(detid)) {
112  LogDebug("CalibrationTrackSelectorFromDetIdList") << "Selected by selection " << detid.rawId();
113  saveTrack = true;
114  break;
115  }
116  }
117 
118  // here there will be the selection
119  hits.emplace_back(hit);
120  }
121 
122  if (saveTrack) {
123  output->push_back(makeCandidate(trk, hits.begin(), hits.end()));
124  }
125  }
126  iEvent.put(std::move(output));
127 }

References detidsels_, hfClusterShapes_cfi::hits, iEvent, LogDebug, m_label, makeCandidate(), eostools::move(), convertSQLitetoXML_cfg::output, DetId::rawId(), and tracks.

Member Data Documentation

◆ detidsels_

std::vector<DetIdSelector> CalibrationTrackSelectorFromDetIdList::detidsels_
private

◆ geometryToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> CalibrationTrackSelectorFromDetIdList::geometryToken_
private

Definition at line 57 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun().

◆ m_label

edm::EDGetTokenT<reco::TrackCollection> CalibrationTrackSelectorFromDetIdList::m_label
private

◆ m_verbose

bool CalibrationTrackSelectorFromDetIdList::m_verbose
private

◆ magFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CalibrationTrackSelectorFromDetIdList::magFieldToken_
private

Definition at line 58 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun().

◆ theGeometry

edm::ESHandle<TrackerGeometry> CalibrationTrackSelectorFromDetIdList::theGeometry
private

Definition at line 63 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun(), and makeCandidate().

◆ theMagField

edm::ESHandle<MagneticField> CalibrationTrackSelectorFromDetIdList::theMagField
private

Definition at line 64 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun(), and makeCandidate().

reco::Track::outerPosition
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CalibrationTrackSelectorFromDetIdList::theMagField
edm::ESHandle< MagneticField > theMagField
Definition: CalibrationTrackSelectorFromDetIdList.cc:64
reco::Track::outerDetId
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:79
anyDirection
Definition: PropagationDirection.h:4
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
CalibrationTrackSelectorFromDetIdList::geometryToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
Definition: CalibrationTrackSelectorFromDetIdList.cc:57
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm
HLT enums.
Definition: AlignableModifier.h:19
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CalibrationTrackSelectorFromDetIdList::m_label
edm::EDGetTokenT< reco::TrackCollection > m_label
Definition: CalibrationTrackSelectorFromDetIdList.cc:52
edm::Handle
Definition: AssociativeIterator.h:50
CalibrationTrackSelectorFromDetIdList::makeCandidate
TrackCandidate makeCandidate(const reco::Track &tk, std::vector< const TrackingRecHit * >::iterator hitsBegin, std::vector< const TrackingRecHit * >::iterator hitsEnd)
Definition: CalibrationTrackSelectorFromDetIdList.cc:129
trajectoryStateTransform::outerStateOnSurface
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:118
fileCollector.seed
seed
Definition: fileCollector.py:127
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
CalibrationTrackSelectorFromDetIdList::theGeometry
edm::ESHandle< TrackerGeometry > theGeometry
Definition: CalibrationTrackSelectorFromDetIdList.cc:63
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
edm::OwnVector::reserve
void reserve(size_t)
Definition: OwnVector.h:320
reco::Track::seedDirection
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:148
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
TrackCandidate
Definition: TrackCandidate.h:24
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
cand
Definition: decayParser.h:32
reco::Track::innerPosition
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
reco::Track::innerDetId
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
CalibrationTrackSelectorFromDetIdList::m_verbose
bool m_verbose
Definition: CalibrationTrackSelectorFromDetIdList.cc:61
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
reco::Track::seedRef
const edm::RefToBase< TrajectorySeed > & seedRef() const
Definition: Track.h:155
Exception
Definition: hltDiff.cc:245
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
TrajectorySeed
Definition: TrajectorySeed.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackerGeometry::detIds
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: TrackerGeometry.h:64
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
trajectoryStateTransform::innerStateOnSurface
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:110
reco::TrackBase::momentum
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
CalibrationTrackSelectorFromDetIdList::magFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: CalibrationTrackSelectorFromDetIdList.cc:58
CalibrationTrackSelectorFromDetIdList::detidsels_
std::vector< DetIdSelector > detidsels_
Definition: CalibrationTrackSelectorFromDetIdList.cc:60
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
DetIdSelector
Definition: DetIdSelector.h:12
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >