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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CosmicTrackFinder (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~CosmicTrackFinder ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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<>
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 67 of file CosmicTrackFinder.h.

Member Typedef Documentation

Definition at line 70 of file CosmicTrackFinder.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file CosmicTrackFinder.cc.

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

30  :
33  {
34  geometry=conf.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
35  useHitsSplitting_=conf.getParameter<bool>("useHitsSplitting");
36  matchedrecHitsToken_ = consumes<SiStripMatchedRecHit2DCollection>(
37  conf.getParameter<edm::InputTag>("matchedRecHits"));
38  rphirecHitsToken_ = consumes<SiStripRecHit2DCollection>(
39  conf.getParameter<edm::InputTag>("rphirecHits"));
40  stereorecHitsToken_ = consumes<SiStripRecHit2DCollection>(
41  conf.getParameter<edm::InputTag>("stereorecHits"));
42  pixelRecHitsToken_ = consumes<SiPixelRecHitCollection>(
43  conf.getParameter<edm::InputTag>("pixelRecHits"));
44  seedToken_ = consumes<TrajectorySeedCollection>(
45  conf.getParameter<edm::InputTag>("cosmicSeeds"));
46 
47  produces<TrackCandidateCollection>();
48  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
CRackTrajectoryBuilder crackTrajectoryBuilder_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitsToken_
edm::EDGetTokenT< TrajectorySeedCollection > seedToken_
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
cms::CosmicTrackFinder::~CosmicTrackFinder ( )
virtual

Definition at line 52 of file CosmicTrackFinder.cc.

52 { }

Member Function Documentation

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

.....

Definition at line 55 of file CosmicTrackFinder.cc.

References alongMomentum, patCaloMETCorrections_cff::C, cosmicTrajectoryBuilder_, gather_cfg::cout, crackTrajectoryBuilder_, edm::OwnVector< T, P >::front(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByToken(), CosmicTrajectoryBuilder::hitBuilder(), CRackTrajectoryBuilder::hitBuilder(), TrajectoryStateOnSurface::isValid(), checklumidiff::l, edm::EDConsumerBase::labelsForToken(), TrajectoryStateOnSurface::localParameters(), LogDebug, TrajectoryStateOnSurface::magneticField(), AlignmentTrackSelector_cfi::matchedrecHits, matchedrecHitsToken_, edm::ProductLabels::module, eostools::move(), convertSQLitetoXML_cfg::output, trajectoryStateTransform::persistentState(), NuclearInteractionSecond_cff::pixelHits, pixelRecHitsToken_, edm::Handle< T >::product(), edm::Event::put(), DetId::rawId(), TrackingRecHit::rawId(), edm::OwnVector< T, P >::reverse(), AlignmentTrackSelector_cfi::rphirecHits, rphirecHitsToken_, CosmicTrajectoryBuilder::run(), CRackTrajectoryBuilder::run(), SurveyInfoScenario_cff::seed, seedToken_, convBremSeeds_cfi::stereorecHits, stereorecHitsToken_, TrajectoryStateOnSurface::surface(), mixOne_simraw_on_sim_cfi::tracker, and useHitsSplitting_.

56  {
57  using namespace std;
58 
59  // retrieve seeds
61  e.getByToken(seedToken_, seed);
62 
63  //retrieve PixelRecHits
64  static const SiPixelRecHitCollection s_empty;
65  const SiPixelRecHitCollection *pixelHitCollection = &s_empty;
67  if (geometry!="MTCC" && (geometry!="CRACK" )) {
68  if( e.getByToken(pixelRecHitsToken_, pixelHits)) {
69  pixelHitCollection = pixelHits.product();
70  } else {
71  Labels l;
73  edm::LogWarning("CosmicTrackFinder")
74  << "Collection SiPixelRecHitCollection with InputTag "
75  << l.module
76  << " cannot be found, using empty collection of same type.";
77  }
78  }
79 
80 
81 
82 
83  //retrieve StripRecHits
85  e.getByToken(matchedrecHitsToken_, matchedrecHits);
87  e.getByToken(rphirecHitsToken_, rphirecHits);
89  e.getByToken(stereorecHitsToken_, stereorecHits);
90 
91  // Step B: create empty output collection
92  auto output = std::make_unique<TrackCandidateCollection>();
93 
95  es.get<TrackerDigiGeometryRecord>().get(tracker);
96  edm::LogVerbatim("CosmicTrackFinder") << "========== Cosmic Track Finder Info ==========";
97  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Seeds " << (*seed).size();
98  if((*seed).size()>0){
99 
100  std::vector<Trajectory> trajoutput;
101 
102 
103  const TransientTrackingRecHitBuilder * hitBuilder = nullptr;
104  if(geometry!="CRACK" ) {
106  *stereorecHits,
107  *rphirecHits,
108  *matchedrecHits,
109  *pixelHitCollection,
110  es,
111  e,
112  trajoutput);
113  hitBuilder = cosmicTrajectoryBuilder_.hitBuilder();
114  } else {
116  *stereorecHits,
117  *rphirecHits,
118  *matchedrecHits,
119  *pixelHitCollection,
120  es,
121  e,
122  trajoutput);
123  hitBuilder = crackTrajectoryBuilder_.hitBuilder();
124  }
125  assert(hitBuilder);
126  Traj2TrackHits t2t(hitBuilder,true);
127 
128  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Temp Trajectories " << trajoutput.size();
129  edm::LogVerbatim("CosmicTrackFinder") << "========== END Info ==========";
130  if(trajoutput.size()>0){
131 
132  // crazyness...
133  std::vector<Trajectory*> tmpTraj;
134  std::vector<Trajectory>::iterator itr;
135  for (itr=trajoutput.begin();itr!=trajoutput.end();itr++)tmpTraj.push_back(&(*itr));
136 
137  //The best track is selected
138  //FOR MTCC the criteria are:
139  //1)# of layers,2) # of Hits,3)Chi2
140  if (geometry=="MTCC") stable_sort(tmpTraj.begin(),tmpTraj.end(),CompareTrajLay());
141  else stable_sort(tmpTraj.begin(),tmpTraj.end(),CompareTrajChi());
142 
144 
145  const Trajectory theTraj = *(*tmpTraj.begin());
146  bool seedplus=(theTraj.seed().direction()==alongMomentum);
147 
148  // std::cout << "CosmicTrackFinder " <<"Reconstruction " << (seedplus ? "along" : "opposite to") << " momentum" << std::endl;
149  LogDebug("CosmicTrackFinder")<<"Reconstruction " << (seedplus ? "along" : "opposite to") << " momentum";
150 
151  /*
152  // === the convention is to save always final tracks with hits sorted *along* momentum
153  // --- this is NOT what was necessaraly happening before and not consistent with what done in standard CKF (this is a candidate not a track)
154  */
156  if(theTraj.direction() == alongMomentum) std::cout << "cosmic: along momentum... " << std::endl;
157  t2t(theTraj,recHits,useHitsSplitting_);
158  recHits.reverse(); // according to original code
159 
160  /*
161  Trajectory::RecHitContainer thits;
162  //it->recHitsV(thits);
163  theTraj.recHitsV(thits,useHitsSplitting_);
164  edm::OwnVector<TrackingRecHit> recHits;
165  recHits.reserve(thits.size());
166  // reverse hit order
167  for (Trajectory::RecHitContainer::const_iterator hitIt = thits.end()-1;
168  hitIt >= thits.begin(); hitIt--) {
169  recHits.push_back( (**hitIt).hit()->clone());
170  }
171  */
172 
173  TSOS firstState;
174  unsigned int firstId;
175 
176  // assume not along momentum....
177  firstState=theTraj.lastMeasurement().updatedState();
178  firstId = theTraj.lastMeasurement().recHitR().rawId();
179  //firstId = recHits.front().rawId();
180 
181  /*
182  cout << "firstState y, z: " << firstState.globalPosition().y()
183  << " , " << firstState.globalPosition().z() << endl;
184 
185  */
186 
188  TSOS startingState( firstState.localParameters(), LocalTrajectoryError(C),
189  firstState.surface(),
190  firstState.magneticField() );
191 
192  // protection againt invalid initial states
193  if (! firstState.isValid()) {
194  edm::LogWarning("CosmicTrackFinder") << "invalid innerState, will not make TrackCandidate";
196  return;
197  }
198 
199  // FIXME in case of slitting this can happen see CkfTrackCandidateMakerBase
200  if(firstId != recHits.front().rawId()){
201  edm::LogWarning("CosmicTrackFinder") <<"Mismatch in DetID of first hit: firstID= " <<firstId
202  << " DetId= " << recHits.front().geographicalId().rawId();
204  return;
205  }
206 
207  PTrajectoryStateOnDet const & state = trajectoryStateTransform::persistentState( startingState, firstId);
208 
209 
210  output->push_back(TrackCandidate(recHits,theTraj.seed(),state,theTraj.seedRef() ) );
211 
212  }
213 
214  }
216  }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
const LocalTrajectoryParameters & localParameters() const
edm::EDGetTokenT< SiStripRecHit2DCollection > stereorecHitsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticField * magneticField() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const TransientTrackingRecHitBuilder * hitBuilder() const
void reverse()
Definition: OwnVector.h:159
const SurfaceType & surface() const
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_
const TransientTrackingRecHitBuilder * hitBuilder() const
edm::EDGetTokenT< TrajectorySeedCollection > seedToken_
ProductLabels Labels
T const * product() const
Definition: Handle.h:81
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_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
DetId geographicalId() const
reference front()
Definition: OwnVector.h:423
def move(src, dest)
Definition: eostools.py:510
id_type rawId() const

Member Data Documentation

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

Definition at line 82 of file CosmicTrackFinder.h.

CosmicTrajectoryBuilder cms::CosmicTrackFinder::cosmicTrajectoryBuilder_
private

Definition at line 80 of file CosmicTrackFinder.h.

Referenced by produce().

CRackTrajectoryBuilder cms::CosmicTrackFinder::crackTrajectoryBuilder_
private

Definition at line 81 of file CosmicTrackFinder.h.

Referenced by produce().

std::string cms::CosmicTrackFinder::geometry
private
edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> cms::CosmicTrackFinder::matchedrecHitsToken_
private

Definition at line 86 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

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

Definition at line 89 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

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

Definition at line 87 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

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

Definition at line 90 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

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

Definition at line 88 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

bool cms::CosmicTrackFinder::trinevents
private

Definition at line 84 of file CosmicTrackFinder.h.

bool cms::CosmicTrackFinder::useHitsSplitting_
private

Definition at line 85 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().