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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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 43 of file CalibrationTrackSelectorFromDetIdList.cc.

Constructor & Destructor Documentation

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

Definition at line 63 of file CalibrationTrackSelectorFromDetIdList.cc.

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

64  : detidsels_() {
65  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet>>("selections");
66 
67  for (std::vector<edm::ParameterSet>::const_iterator selconfig = selconfigs.begin(); selconfig != selconfigs.end();
68  ++selconfig) {
69  DetIdSelector selection(*selconfig);
70  detidsels_.push_back(selection);
71  }
72 
73  m_verbose = iConfig.getUntrackedParameter<bool>("verbose");
74  m_label = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("Input"));
75  produces<TrackCandidateCollection>();
76 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
selection
main part
Definition: corrVsCorr.py:100
edm::EDGetTokenT< reco::TrackCollection > m_label
CalibrationTrackSelectorFromDetIdList::~CalibrationTrackSelectorFromDetIdList ( )
override

Definition at line 78 of file CalibrationTrackSelectorFromDetIdList.cc.

78 {}

Member Function Documentation

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

Definition at line 155 of file CalibrationTrackSelectorFromDetIdList.cc.

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

155  {
158 
159  if (m_verbose) {
160  for (const auto &detidsel : detidsels_) {
161  auto theDetIds = theGeometry.product()->detIds();
162  for (const auto &theDet : theDetIds) {
163  if (detidsel.isSelected(theDet)) {
164  LogDebug("CalibrationTrackSelectorFromDetIdList") << "detid: " << theDet.rawId() << " is taken" << std::endl;
165  }
166  }
167  }
168  }
169 }
#define LogDebug(id)
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
TrackCandidate CalibrationTrackSelectorFromDetIdList::makeCandidate ( const reco::Track tk,
std::vector< const TrackingRecHit * >::iterator  hitsBegin,
std::vector< const TrackingRecHit * >::iterator  hitsEnd 
)
private

Definition at line 123 of file CalibrationTrackSelectorFromDetIdList.cc.

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(), SurveyInfoScenario_cff::seed, reco::Track::seedDirection(), reco::Track::seedRef(), theGeometry, and theMagField.

Referenced by produce().

126  {
128  PTrajectoryStateOnDet state;
129  if (pdir == anyDirection)
130  throw cms::Exception("UnimplementedFeature") << "Cannot work with tracks that have 'anyDirecton' \n";
131 
132  if ((pdir == alongMomentum) == ((tk.outerPosition() - tk.innerPosition()).Dot(tk.momentum()) >= 0)) {
133  // use inner state
134  TrajectoryStateOnSurface originalTsosIn(
136  state = trajectoryStateTransform::persistentState(originalTsosIn, DetId(tk.innerDetId()));
137  } else {
138  // use outer state
139  TrajectoryStateOnSurface originalTsosOut(
141  state = trajectoryStateTransform::persistentState(originalTsosOut, DetId(tk.outerDetId()));
142  }
145  ownHits.reserve(hitsEnd - hitsBegin);
146  for (; hitsBegin != hitsEnd; ++hitsBegin) {
147  ownHits.push_back((*hitsBegin)->clone());
148  }
149 
150  TrackCandidate cand(ownHits, seed, state, tk.seedRef());
151 
152  return cand;
153 }
const edm::RefToBase< TrajectorySeed > & seedRef() const
Definition: Track.h:155
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
PropagationDirection
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:629
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
void push_back(D *&d)
Definition: OwnVector.h:326
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:79
Definition: DetId.h:17
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:148
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
void reserve(size_t)
Definition: OwnVector.h:320
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
void CalibrationTrackSelectorFromDetIdList::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 85 of file CalibrationTrackSelectorFromDetIdList.cc.

References detidsels_, edm::Event::getByToken(), hfClusterShapes_cfi::hits, LogDebug, m_label, makeCandidate(), eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), and PDWG_EXOHSCP_cff::tracks.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

85  {
86  using namespace edm;
87  using namespace std;
88 
89  edm::Handle<std::vector<reco::Track>> trackCollectionHandle;
90  iEvent.getByToken(m_label, trackCollectionHandle);
91  auto const &tracks = *trackCollectionHandle;
92 
93  auto output = std::make_unique<TrackCandidateCollection>();
94 
95  // loop on tracks
96  for (auto &trk : tracks) {
97  std::vector<const TrackingRecHit *> hits;
98 
99  bool saveTrack(false);
100 
101  for (auto const &hit : trk.recHits()) {
102  DetId detid = hit->geographicalId();
103 
104  for (const auto &detidsel : detidsels_) {
105  if (detidsel.isSelected(detid)) {
106  LogDebug("CalibrationTrackSelectorFromDetIdList") << "Selected by selection " << detid;
107  saveTrack = true;
108  break;
109  }
110  }
111 
112  // here there will be the selection
113  hits.emplace_back(hit);
114  }
115 
116  if (saveTrack) {
117  output->push_back(makeCandidate(trk, hits.begin(), hits.end()));
118  }
119  }
120  iEvent.put(std::move(output));
121 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::TrackCollection > m_label
TrackCandidate makeCandidate(const reco::Track &tk, std::vector< const TrackingRecHit * >::iterator hitsBegin, std::vector< const TrackingRecHit * >::iterator hitsEnd)
Definition: DetId.h:17
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

std::vector<DetIdSelector> CalibrationTrackSelectorFromDetIdList::detidsels_
private
edm::EDGetTokenT<reco::TrackCollection> CalibrationTrackSelectorFromDetIdList::m_label
private
bool CalibrationTrackSelectorFromDetIdList::m_verbose
private
edm::ESHandle<TrackerGeometry> CalibrationTrackSelectorFromDetIdList::theGeometry
private

Definition at line 59 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun(), and makeCandidate().

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

Definition at line 60 of file CalibrationTrackSelectorFromDetIdList.cc.

Referenced by beginRun(), and makeCandidate().