CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
cms::CosmicTrackFinder Class Reference

#include <CosmicTrackFinder.h>

Inheritance diagram for cms::CosmicTrackFinder:
edm::stream::EDProducer<>

Public Member Functions

 CosmicTrackFinder (const edm::ParameterSet &conf)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~CosmicTrackFinder () 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 Types

typedef TrajectoryStateOnSurface TSOS
 

Private Attributes

edm::ParameterSet conf_
 
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
 
CRackTrajectoryBuilder crackTrajectoryBuilder_
 
std::string geometry
 
edm::EDGetTokenT< SiStripMatchedRecHit2DCollectionmatchedrecHitsToken_
 
edm::EDGetTokenT< SiPixelRecHitCollectionpixelRecHitsToken_
 
edm::EDGetTokenT< SiStripRecHit2DCollectionrphirecHitsToken_
 
edm::EDGetTokenT< TrajectorySeedCollectionseedToken_
 
edm::EDGetTokenT< SiStripRecHit2DCollectionstereorecHitsToken_
 
bool trinevents
 
bool useHitsSplitting_
 

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

Definition at line 69 of file CosmicTrackFinder.h.

Member Typedef Documentation

◆ TSOS

Definition at line 70 of file CosmicTrackFinder.h.

Constructor & Destructor Documentation

◆ CosmicTrackFinder()

cms::CosmicTrackFinder::CosmicTrackFinder ( const edm::ParameterSet conf)
explicit

Definition at line 28 of file CosmicTrackFinder.cc.

30  geometry = conf.getUntrackedParameter<std::string>("GeometricStructure", "STANDARD");
31  useHitsSplitting_ = conf.getParameter<bool>("useHitsSplitting");
33  consumes<SiStripMatchedRecHit2DCollection>(conf.getParameter<edm::InputTag>("matchedRecHits"));
34  rphirecHitsToken_ = consumes<SiStripRecHit2DCollection>(conf.getParameter<edm::InputTag>("rphirecHits"));
35  stereorecHitsToken_ = consumes<SiStripRecHit2DCollection>(conf.getParameter<edm::InputTag>("stereorecHits"));
36  pixelRecHitsToken_ = consumes<SiPixelRecHitCollection>(conf.getParameter<edm::InputTag>("pixelRecHits"));
37  seedToken_ = consumes<TrajectorySeedCollection>(conf.getParameter<edm::InputTag>("cosmicSeeds"));
38 
39  produces<TrackCandidateCollection>();
40  }

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), matchedrecHitsToken_, pixelRecHitsToken_, rphirecHitsToken_, seedToken_, stereorecHitsToken_, AlCaHLTBitMon_QueryRunRegistry::string, and useHitsSplitting_.

◆ ~CosmicTrackFinder()

cms::CosmicTrackFinder::~CosmicTrackFinder ( )
override

Definition at line 43 of file CosmicTrackFinder.cc.

43 {}

Member Function Documentation

◆ produce()

void cms::CosmicTrackFinder::produce ( edm::Event e,
const edm::EventSetup c 
)
override

.....

Definition at line 46 of file CosmicTrackFinder.cc.

46  {
47  using namespace std;
48 
49  // retrieve seeds
51  e.getByToken(seedToken_, seed);
52 
53  //retrieve PixelRecHits
54  static const SiPixelRecHitCollection s_empty;
57  if (geometry != "MTCC" && (geometry != "CRACK")) {
58  if (e.getByToken(pixelRecHitsToken_, pixelHits)) {
59  pixelHitCollection = pixelHits.product();
60  } else {
61  Labels l;
62  labelsForToken(pixelRecHitsToken_, l);
63  edm::LogWarning("CosmicTrackFinder") << "Collection SiPixelRecHitCollection with InputTag " << l.module
64  << " cannot be found, using empty collection of same type.";
65  }
66  }
67 
68  //retrieve StripRecHits
72  e.getByToken(rphirecHitsToken_, rphirecHits);
74  e.getByToken(stereorecHitsToken_, stereorecHits);
75 
76  // Step B: create empty output collection
77  auto output = std::make_unique<TrackCandidateCollection>();
78 
81  edm::LogVerbatim("CosmicTrackFinder") << "========== Cosmic Track Finder Info ==========";
82  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Seeds " << (*seed).size();
83  if (!(*seed).empty()) {
84  std::vector<Trajectory> trajoutput;
85 
86  const TransientTrackingRecHitBuilder* hitBuilder = nullptr;
87  if (geometry != "CRACK") {
90  hitBuilder = cosmicTrajectoryBuilder_.hitBuilder();
91  } else {
94  hitBuilder = crackTrajectoryBuilder_.hitBuilder();
95  }
96  assert(hitBuilder);
97  Traj2TrackHits t2t(hitBuilder, true);
98 
99  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Temp Trajectories " << trajoutput.size();
100  edm::LogVerbatim("CosmicTrackFinder") << "========== END Info ==========";
101  if (!trajoutput.empty()) {
102  // crazyness...
103  std::vector<Trajectory*> tmpTraj;
104  std::vector<Trajectory>::iterator itr;
105  for (itr = trajoutput.begin(); itr != trajoutput.end(); itr++)
106  tmpTraj.push_back(&(*itr));
107 
108  //The best track is selected
109  //FOR MTCC the criteria are:
110  //1)# of layers,2) # of Hits,3)Chi2
111  if (geometry == "MTCC")
112  stable_sort(tmpTraj.begin(), tmpTraj.end(), CompareTrajLay());
113  else
114  stable_sort(tmpTraj.begin(), tmpTraj.end(), CompareTrajChi());
115 
117 
118  const Trajectory theTraj = *(*tmpTraj.begin());
119  bool seedplus = (theTraj.seed().direction() == alongMomentum);
120 
121  // std::cout << "CosmicTrackFinder " <<"Reconstruction " << (seedplus ? "along" : "opposite to") << " momentum" << std::endl;
122  LogDebug("CosmicTrackFinder") << "Reconstruction " << (seedplus ? "along" : "opposite to") << " momentum";
123 
124  /*
125  // === the convention is to save always final tracks with hits sorted *along* momentum
126  // --- this is NOT what was necessaraly happening before and not consistent with what done in standard CKF (this is a candidate not a track)
127  */
129  if (theTraj.direction() == alongMomentum)
130  std::cout << "cosmic: along momentum... " << std::endl;
131  t2t(theTraj, recHits, useHitsSplitting_);
132  recHits.reverse(); // according to original code
133 
134  /*
135  Trajectory::RecHitContainer thits;
136  //it->recHitsV(thits);
137  theTraj.recHitsV(thits,useHitsSplitting_);
138  edm::OwnVector<TrackingRecHit> recHits;
139  recHits.reserve(thits.size());
140  // reverse hit order
141  for (Trajectory::RecHitContainer::const_iterator hitIt = thits.end()-1;
142  hitIt >= thits.begin(); hitIt--) {
143  recHits.push_back( (**hitIt).hit()->clone());
144  }
145  */
146 
147  TSOS firstState;
148  unsigned int firstId;
149 
150  // assume not along momentum....
151  firstState = theTraj.lastMeasurement().updatedState();
152  firstId = theTraj.lastMeasurement().recHitR().rawId();
153  //firstId = recHits.front().rawId();
154 
155  /*
156  cout << "firstState y, z: " << firstState.globalPosition().y()
157  << " , " << firstState.globalPosition().z() << endl;
158 
159  */
160 
162  TSOS startingState(
163  firstState.localParameters(), LocalTrajectoryError(C), firstState.surface(), firstState.magneticField());
164 
165  // protection againt invalid initial states
166  if (!firstState.isValid()) {
167  edm::LogWarning("CosmicTrackFinder") << "invalid innerState, will not make TrackCandidate";
169  return;
170  }
171 
172  // FIXME in case of slitting this can happen see CkfTrackCandidateMakerBase
173  if (firstId != recHits.front().rawId()) {
174  edm::LogWarning("CosmicTrackFinder") << "Mismatch in DetID of first hit: firstID= " << firstId
175  << " DetId= " << recHits.front().geographicalId().rawId();
177  return;
178  }
179 
181 
182  output->push_back(TrackCandidate(recHits, theTraj.seed(), state, theTraj.seedRef()));
183  }
184  }
186  }

References alongMomentum, cms::cuda::assert(), gen::C, cosmicTrajectoryBuilder_, gather_cfg::cout, crackTrajectoryBuilder_, MillePedeFileConverter_cfg::e, edm::EventSetup::get(), get, CosmicTrajectoryBuilder::hitBuilder(), CRackTrajectoryBuilder::hitBuilder(), TrajectoryStateOnSurface::isValid(), cmsLHEtoEOSManager::l, TrajectoryStateOnSurface::localParameters(), LogDebug, TrajectoryStateOnSurface::magneticField(), AlignmentTrackSelector_cfi::matchedrecHits, matchedrecHitsToken_, eostools::move(), convertSQLitetoXML_cfg::output, trajectoryStateTransform::persistentState(), beampixel_dqm_sourceclient-live_cfg::pixelHitCollection, InitialStepPreSplitting_cff::pixelHits, pixelRecHitsToken_, FastTrackerRecHitMaskProducer_cfi::recHits, AlignmentTrackSelector_cfi::rphirecHits, rphirecHitsToken_, CosmicTrajectoryBuilder::run(), CRackTrajectoryBuilder::run(), fileCollector::seed, seedToken_, RecoTrackerTopBottom_cff::stereorecHits, stereorecHitsToken_, TrajectoryStateOnSurface::surface(), PbPb_ZMuSkimMuonDPG_cff::tracker, and useHitsSplitting_.

Member Data Documentation

◆ conf_

edm::ParameterSet cms::CosmicTrackFinder::conf_
private

Definition at line 82 of file CosmicTrackFinder.h.

◆ cosmicTrajectoryBuilder_

CosmicTrajectoryBuilder cms::CosmicTrackFinder::cosmicTrajectoryBuilder_
private

Definition at line 80 of file CosmicTrackFinder.h.

Referenced by produce().

◆ crackTrajectoryBuilder_

CRackTrajectoryBuilder cms::CosmicTrackFinder::crackTrajectoryBuilder_
private

Definition at line 81 of file CosmicTrackFinder.h.

Referenced by produce().

◆ geometry

std::string cms::CosmicTrackFinder::geometry
private

Definition at line 83 of file CosmicTrackFinder.h.

◆ matchedrecHitsToken_

edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> cms::CosmicTrackFinder::matchedrecHitsToken_
private

Definition at line 86 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

◆ pixelRecHitsToken_

edm::EDGetTokenT<SiPixelRecHitCollection> cms::CosmicTrackFinder::pixelRecHitsToken_
private

Definition at line 89 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

◆ rphirecHitsToken_

edm::EDGetTokenT<SiStripRecHit2DCollection> cms::CosmicTrackFinder::rphirecHitsToken_
private

Definition at line 87 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

◆ seedToken_

edm::EDGetTokenT<TrajectorySeedCollection> cms::CosmicTrackFinder::seedToken_
private

Definition at line 90 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

◆ stereorecHitsToken_

edm::EDGetTokenT<SiStripRecHit2DCollection> cms::CosmicTrackFinder::stereorecHitsToken_
private

Definition at line 88 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

◆ trinevents

bool cms::CosmicTrackFinder::trinevents
private

Definition at line 84 of file CosmicTrackFinder.h.

◆ useHitsSplitting_

bool cms::CosmicTrackFinder::useHitsSplitting_
private

Definition at line 85 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

cms::CosmicTrackFinder::matchedrecHitsToken_
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
Definition: CosmicTrackFinder.h:86
CRackTrajectoryBuilder::run
void run(const TrajectorySeedCollection &collseed, const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const edm::EventSetup &es, edm::Event &e, std::vector< Trajectory > &trajoutput)
Runs the algorithm.
Definition: CRackTrajectoryBuilder.cc:82
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
cms::CosmicTrackFinder::pixelRecHitsToken_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitsToken_
Definition: CosmicTrackFinder.h:89
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
gather_cfg.cout
cout
Definition: gather_cfg.py:144
geometry
Definition: geometry.py:1
AlignmentTrackSelector_cfi.matchedrecHits
matchedrecHits
Definition: AlignmentTrackSelector_cfi.py:64
cms::cuda::assert
assert(be >=bs)
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
cms::CosmicTrackFinder::useHitsSplitting_
bool useHitsSplitting_
Definition: CosmicTrackFinder.h:85
AlgebraicMatrixID
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Definition: AlgebraicROOTObjects.h:72
fileCollector.seed
seed
Definition: fileCollector.py:127
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
RecoTrackerTopBottom_cff.stereorecHits
stereorecHits
Definition: RecoTrackerTopBottom_cff.py:254
cms::CosmicTrackFinder::crackTrajectoryBuilder_
CRackTrajectoryBuilder crackTrajectoryBuilder_
Definition: CosmicTrackFinder.h:81
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:16
edm::ESHandle< TrackerGeometry >
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
CosmicTrajectoryBuilder::run
void run(const TrajectorySeedCollection &collseed, const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const edm::EventSetup &es, edm::Event &e, std::vector< Trajectory > &trajoutput)
Runs the algorithm.
Definition: CosmicTrajectoryBuilder.cc:68
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
LocalTrajectoryError
Definition: LocalTrajectoryError.h:20
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
cms::CosmicTrackFinder::stereorecHitsToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
Definition: CosmicTrackFinder.h:88
TrackCandidate
Definition: TrackCandidate.h:24
Traj2TrackHits
Definition: Traj2TrackHits.h:16
cms::CosmicTrackFinder::cosmicTrajectoryBuilder_
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
Definition: CosmicTrackFinder.h:80
CRackTrajectoryBuilder::hitBuilder
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: CRackTrajectoryBuilder.h:192
cms::CosmicTrackFinder::seedToken_
edm::EDGetTokenT< TrajectorySeedCollection > seedToken_
Definition: CosmicTrackFinder.h:90
get
#define get
cms::CosmicTrackFinder::rphirecHitsToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
Definition: CosmicTrackFinder.h:87
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
gen::C
C
Definition: PomwigHadronizer.cc:78
Trajectory
Definition: Trajectory.h:38
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
AlignmentTrackSelector_cfi.rphirecHits
rphirecHits
Definition: AlignmentTrackSelector_cfi.py:63
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
TransientTrackingRecHitBuilder
Definition: TransientTrackingRecHitBuilder.h:6
InitialStepPreSplitting_cff.pixelHits
pixelHits
Definition: InitialStepPreSplitting_cff.py:142
CosmicTrajectoryBuilder::hitBuilder
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: CosmicTrajectoryBuilder.h:96
TrajectoryStateOnSurface::magneticField
const MagneticField * magneticField() const
Definition: TrajectoryStateOnSurface.h:62
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
edm::OwnVector< TrackingRecHit >
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
beampixel_dqm_sourceclient-live_cfg.pixelHitCollection
pixelHitCollection
Definition: beampixel_dqm_sourceclient-live_cfg.py:138