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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
edm::EDGetTokenT< reco::TrackCollectionm_label
 
bool m_verbose
 
edm::ESHandle< TrackerGeometrytheGeometry
 
edm::ESHandle< MagneticFieldtheMagField
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 64 of file CalibrationTrackSelectorFromDetIdList.cc.

65  : detidsels_() {
66  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet>>("selections");
67 
68  for (std::vector<edm::ParameterSet>::const_iterator selconfig = selconfigs.begin(); selconfig != selconfigs.end();
69  ++selconfig) {
70  DetIdSelector selection(*selconfig);
71  detidsels_.push_back(selection);
72  }
73 
74  m_verbose = iConfig.getUntrackedParameter<bool>("verbose");
75  m_label = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("Input"));
76  produces<TrackCandidateCollection>();
77 }

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

◆ ~CalibrationTrackSelectorFromDetIdList()

CalibrationTrackSelectorFromDetIdList::~CalibrationTrackSelectorFromDetIdList ( )
override

Definition at line 79 of file CalibrationTrackSelectorFromDetIdList.cc.

79 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 156 of file CalibrationTrackSelectorFromDetIdList.cc.

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

References TrackerGeometry::detIds(), detidsels_, edm::EventSetup::get(), get, LogDebug, m_verbose, 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 124 of file CalibrationTrackSelectorFromDetIdList.cc.

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

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 86 of file CalibrationTrackSelectorFromDetIdList.cc.

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

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

Member Data Documentation

◆ detidsels_

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

◆ m_label

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

◆ m_verbose

bool CalibrationTrackSelectorFromDetIdList::m_verbose
private

◆ theGeometry

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

Definition at line 60 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun(), and makeCandidate().

◆ theMagField

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

Definition at line 61 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:61
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
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
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:124
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
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
CalibrationTrackSelectorFromDetIdList::theGeometry
edm::ESHandle< TrackerGeometry > theGeometry
Definition: CalibrationTrackSelectorFromDetIdList.cc:60
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
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:223
TrackCandidate
Definition: TrackCandidate.h:24
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
reco::Track::innerDetId
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
get
#define get
CalibrationTrackSelectorFromDetIdList::m_verbose
bool m_verbose
Definition: CalibrationTrackSelectorFromDetIdList.cc:58
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:246
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::detidsels_
std::vector< DetIdSelector > detidsels_
Definition: CalibrationTrackSelectorFromDetIdList.cc:57
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
DetIdSelector
Definition: DetIdSelector.h:12
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >