CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
cms::CosmicTrackFinder Class Reference

#include <CosmicTrackFinder.h>

Inheritance diagram for cms::CosmicTrackFinder:
edm::EDProducer 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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef TrajectoryStateOnSurface TSOS
 

Private Attributes

edm::ParameterSet conf_
 
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
 
CRackTrajectoryBuilder crackTrajectoryBuilder_
 
std::string geometry
 
edm::EDGetTokenT
< SiStripMatchedRecHit2DCollection
matchedrecHitsToken_
 
edm::EDGetTokenT
< SiPixelRecHitCollection
pixelRecHitsToken_
 
edm::EDGetTokenT
< SiStripRecHit2DCollection
rphirecHitsToken_
 
edm::EDGetTokenT
< TrajectorySeedCollection
seedToken_
 
edm::EDGetTokenT
< SiStripRecHit2DCollection
stereorecHitsToken_
 
bool trinevents
 
bool useHitsSplitting_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 conf_, geometry, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), matchedrecHitsToken_, pixelRecHitsToken_, rphirecHitsToken_, seedToken_, stereorecHitsToken_, AlCaHLTBitMon_QueryRunRegistry::string, and useHitsSplitting_.

30  :
33  conf_(conf)
34  {
35  geometry=conf_.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
36  useHitsSplitting_=conf.getParameter<bool>("useHitsSplitting");
37  matchedrecHitsToken_ = consumes<SiStripMatchedRecHit2DCollection>(
38  conf_.getParameter<edm::InputTag>("matchedRecHits"));
39  rphirecHitsToken_ = consumes<SiStripRecHit2DCollection>(
40  conf_.getParameter<edm::InputTag>("rphirecHits"));
41  stereorecHitsToken_ = consumes<SiStripRecHit2DCollection>(
42  conf_.getParameter<edm::InputTag>("stereorecHits"));
43  pixelRecHitsToken_ = consumes<SiPixelRecHitCollection>(
44  conf_.getParameter<edm::InputTag>("pixelRecHits"));
45  seedToken_ = consumes<TrajectorySeedCollection>(
46  conf_.getParameter<edm::InputTag>("cosmicSeeds"));
47 
48  produces<TrackCandidateCollection>();
49  }
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_
edm::ParameterSet conf_
cms::CosmicTrackFinder::~CosmicTrackFinder ( )
virtual

Definition at line 53 of file CosmicTrackFinder.cc.

53 { }

Member Function Documentation

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

.....

Implements edm::EDProducer.

Definition at line 56 of file CosmicTrackFinder.cc.

References alongMomentum, assert(), funct::C, cosmicTrajectoryBuilder_, gather_cfg::cout, crackTrajectoryBuilder_, edm::OwnVector< T, P >::front(), TrackingRecHit::geographicalId(), geometry, edm::EventSetup::get(), edm::Event::getByToken(), CosmicTrajectoryBuilder::hitBuilder(), CRackTrajectoryBuilder::hitBuilder(), TrajectoryStateOnSurface::isValid(), prof2calltree::l, edm::EDConsumerBase::labelsForToken(), TrajectoryStateOnSurface::localParameters(), LogDebug, TrajectoryStateOnSurface::magneticField(), matchedrecHitsToken_, edm::EDConsumerBase::Labels::module, convertSQLitetoXML_cfg::output, trajectoryStateTransform::persistentState(), pixelRecHitsToken_, edm::Handle< T >::product(), edm::Event::put(), DetId::rawId(), TrackingRecHit::rawId(), edm::OwnVector< T, P >::reverse(), rphirecHitsToken_, CosmicTrajectoryBuilder::run(), CRackTrajectoryBuilder::run(), fileCollector::seed, seedToken_, stereorecHitsToken_, TrajectoryStateOnSurface::surface(), patCandidatesForDimuonsSequences_cff::tracker, and useHitsSplitting_.

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

Member Data Documentation

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

Definition at line 82 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder().

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