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.

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

29  : cosmicTrajectoryBuilder_(conf, consumesCollector()), crackTrajectoryBuilder_(conf, consumesCollector()) {
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  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
T getUntrackedParameter(std::string const &, T const &) const
CRackTrajectoryBuilder crackTrajectoryBuilder_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitsToken_
edm::EDGetTokenT< TrajectorySeedCollection > seedToken_
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_

◆ ~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.

References alongMomentum, cms::cuda::assert(), correctionTermsCaloMet_cff::C, cosmicTrajectoryBuilder_, gather_cfg::cout, crackTrajectoryBuilder_, MillePedeFileConverter_cfg::e, CosmicTrajectoryBuilder::hitBuilder(), CRackTrajectoryBuilder::hitBuilder(), TrajectoryStateOnSurface::isValid(), MainPageGenerator::l, TrajectoryStateOnSurface::localParameters(), LogDebug, TrajectoryStateOnSurface::magneticField(), AlignmentTrackSelector_cfi::matchedrecHits, matchedrecHitsToken_, eostools::move(), 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(), and useHitsSplitting_.

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 
79  edm::LogVerbatim("CosmicTrackFinder") << "========== Cosmic Track Finder Info ==========";
80  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Seeds " << (*seed).size();
81  if (!(*seed).empty()) {
82  std::vector<Trajectory> trajoutput;
83 
84  const TransientTrackingRecHitBuilder* hitBuilder = nullptr;
85  if (geometry != "CRACK") {
88  hitBuilder = cosmicTrajectoryBuilder_.hitBuilder();
89  } else {
92  hitBuilder = crackTrajectoryBuilder_.hitBuilder();
93  }
94  assert(hitBuilder);
95  Traj2TrackHits t2t(hitBuilder, true);
96 
97  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Temp Trajectories " << trajoutput.size();
98  edm::LogVerbatim("CosmicTrackFinder") << "========== END Info ==========";
99  if (!trajoutput.empty()) {
100  // crazyness...
101  std::vector<Trajectory*> tmpTraj;
102  std::vector<Trajectory>::iterator itr;
103  for (itr = trajoutput.begin(); itr != trajoutput.end(); itr++)
104  tmpTraj.push_back(&(*itr));
105 
106  //The best track is selected
107  //FOR MTCC the criteria are:
108  //1)# of layers,2) # of Hits,3)Chi2
109  if (geometry == "MTCC")
110  stable_sort(tmpTraj.begin(), tmpTraj.end(), CompareTrajLay());
111  else
112  stable_sort(tmpTraj.begin(), tmpTraj.end(), CompareTrajChi());
113 
115 
116  const Trajectory theTraj = *(*tmpTraj.begin());
117  bool seedplus = (theTraj.seed().direction() == alongMomentum);
118 
119  // std::cout << "CosmicTrackFinder " <<"Reconstruction " << (seedplus ? "along" : "opposite to") << " momentum" << std::endl;
120  LogDebug("CosmicTrackFinder") << "Reconstruction " << (seedplus ? "along" : "opposite to") << " momentum";
121 
122  /*
123  // === the convention is to save always final tracks with hits sorted *along* momentum
124  // --- this is NOT what was necessaraly happening before and not consistent with what done in standard CKF (this is a candidate not a track)
125  */
127  if (theTraj.direction() == alongMomentum)
128  std::cout << "cosmic: along momentum... " << std::endl;
129  t2t(theTraj, recHits, useHitsSplitting_);
130  recHits.reverse(); // according to original code
131 
132  /*
133  Trajectory::RecHitContainer thits;
134  //it->recHitsV(thits);
135  theTraj.recHitsV(thits,useHitsSplitting_);
136  edm::OwnVector<TrackingRecHit> recHits;
137  recHits.reserve(thits.size());
138  // reverse hit order
139  for (Trajectory::RecHitContainer::const_iterator hitIt = thits.end()-1;
140  hitIt >= thits.begin(); hitIt--) {
141  recHits.push_back( (**hitIt).hit()->clone());
142  }
143  */
144 
145  TSOS firstState;
146  unsigned int firstId;
147 
148  // assume not along momentum....
149  firstState = theTraj.lastMeasurement().updatedState();
150  firstId = theTraj.lastMeasurement().recHitR().rawId();
151  //firstId = recHits.front().rawId();
152 
153  /*
154  cout << "firstState y, z: " << firstState.globalPosition().y()
155  << " , " << firstState.globalPosition().z() << endl;
156 
157  */
158 
160  TSOS startingState(
161  firstState.localParameters(), LocalTrajectoryError(C), firstState.surface(), firstState.magneticField());
162 
163  // protection againt invalid initial states
164  if (!firstState.isValid()) {
165  edm::LogWarning("CosmicTrackFinder") << "invalid innerState, will not make TrackCandidate";
167  return;
168  }
169 
170  // FIXME in case of slitting this can happen see CkfTrackCandidateMakerBase
171  if (firstId != recHits.front().rawId()) {
172  edm::LogWarning("CosmicTrackFinder") << "Mismatch in DetID of first hit: firstID= " << firstId
173  << " DetId= " << recHits.front().geographicalId().rawId();
175  return;
176  }
177 
179 
180  output->push_back(TrackCandidate(recHits, theTraj.seed(), state, theTraj.seedRef()));
181  }
182  }
184  }
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
const TransientTrackingRecHitBuilder * hitBuilder() const
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const LocalTrajectoryParameters & localParameters() const
const SurfaceType & surface() const
assert(be >=bs)
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.
CRackTrajectoryBuilder crackTrajectoryBuilder_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitsToken_
edm::EDGetTokenT< TrajectorySeedCollection > seedToken_
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
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.
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: output.py:1
const MagneticField * magneticField() const
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)
const TransientTrackingRecHitBuilder * hitBuilder() const

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().