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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef TrajectoryStateOnSurface TSOS
 

Private Attributes

edm::ParameterSet conf_
 
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
 
CRackTrajectoryBuilder crackTrajectoryBuilder_
 
std::string geometry
 
bool trinevents
 
bool useHitsSplitting_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 68 of file CosmicTrackFinder.h.

Member Typedef Documentation

Definition at line 71 of file CosmicTrackFinder.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file CosmicTrackFinder.cc.

References conf_, geometry, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and useHitsSplitting_.

28  :
31  conf_(conf)
32  {
33  geometry=conf_.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
34  useHitsSplitting_=conf.getParameter<bool>("useHitsSplitting");
35  produces<TrackCandidateCollection>();
36  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CosmicTrajectoryBuilder cosmicTrajectoryBuilder_
CRackTrajectoryBuilder crackTrajectoryBuilder_
edm::ParameterSet conf_
cms::CosmicTrackFinder::~CosmicTrackFinder ( )
virtual

Definition at line 40 of file CosmicTrackFinder.cc.

40 { }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 43 of file CosmicTrackFinder.cc.

References alongMomentum, funct::C, conf_, cosmicTrajectoryBuilder_, crackTrajectoryBuilder_, edm::OwnVector< T, P >::front(), TrackingRecHit::geographicalId(), geometry, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localParameters(), LogDebug, TrajectoryStateOnSurface::magneticField(), convertSQLitetoXML_cfg::output, trajectoryStateTransform::persistentState(), edm::Handle< T >::product(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), DetId::rawId(), edm::OwnVector< T, P >::reserve(), CosmicTrajectoryBuilder::run(), CRackTrajectoryBuilder::run(), evf::utils::state, TrajectoryStateOnSurface::surface(), patCandidatesForDimuonsSequences_cff::tracker, and useHitsSplitting_.

44  {
45  using namespace std ;
46  edm::InputTag matchedrecHitsTag = conf_.getParameter<edm::InputTag>("matchedRecHits");
47  edm::InputTag rphirecHitsTag = conf_.getParameter<edm::InputTag>("rphirecHits");
48  edm::InputTag stereorecHitsTag = conf_.getParameter<edm::InputTag>("stereorecHits");
49  edm::InputTag pixelRecHitsTag = conf_.getParameter<edm::InputTag>("pixelRecHits");
50 
51 
52  edm::InputTag seedTag = conf_.getParameter<edm::InputTag>("cosmicSeeds");
53  // retrieve seeds
55  e.getByLabel(seedTag,seed);
56 
57  //retrieve PixelRecHits
58  static const SiPixelRecHitCollection s_empty;
59  const SiPixelRecHitCollection *pixelHitCollection = &s_empty;
61  if (geometry!="MTCC" && (geometry!="CRACK" )) {
62  if( e.getByLabel(pixelRecHitsTag, pixelHits)) {
63  pixelHitCollection = pixelHits.product();
64  } else {
65  edm::LogWarning("CosmicTrackFinder") << "Collection SiPixelRecHitCollection with InputTag " << pixelRecHitsTag << " cannot be found, using empty collection of same type.";
66  }
67  }
68 
69 
70 
71 
72  //retrieve StripRecHits
74  e.getByLabel( matchedrecHitsTag ,matchedrecHits);
76  e.getByLabel( rphirecHitsTag ,rphirecHits);
78  e.getByLabel( stereorecHitsTag, stereorecHits);
79 
80  // Step B: create empty output collection
81  std::auto_ptr<TrackCandidateCollection> output(new TrackCandidateCollection);
82 
84  es.get<TrackerDigiGeometryRecord>().get(tracker);
85  edm::LogVerbatim("CosmicTrackFinder") << "========== Cosmic Track Finder Info ==========";
86  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Seeds " << (*seed).size();
87  if((*seed).size()>0){
88 
89  std::vector<Trajectory> trajoutput;
90 
91  if(geometry!="CRACK" ) {
93  *stereorecHits,
94  *rphirecHits,
95  *matchedrecHits,
96  *pixelHitCollection,
97  es,
98  e,
99  trajoutput);
100  } else {
102  *stereorecHits,
103  *rphirecHits,
104  *matchedrecHits,
105  *pixelHitCollection,
106  es,
107  e,
108  trajoutput);
109  }
110 
111  edm::LogVerbatim("CosmicTrackFinder") << " Numbers of Temp Trajectories " << trajoutput.size();
112  edm::LogVerbatim("CosmicTrackFinder") << "========== END Info ==========";
113  if(trajoutput.size()>0){
114  std::vector<Trajectory*> tmpTraj;
115  std::vector<Trajectory>::iterator itr;
116  for (itr=trajoutput.begin();itr!=trajoutput.end();itr++)tmpTraj.push_back(&(*itr));
117 
118  //The best track is selected
119  //FOR MTCC the criteria are:
120  //1)# of layers,2) # of Hits,3)Chi2
121  if (geometry=="MTCC") stable_sort(tmpTraj.begin(),tmpTraj.end(),CompareTrajLay());
122  else stable_sort(tmpTraj.begin(),tmpTraj.end(),CompareTrajChi());
123 
124 
125 
126  const Trajectory theTraj = *(*tmpTraj.begin());
127  bool seedplus=(theTraj.seed().direction()==alongMomentum);
128  //PropagationDirection seedDir =theTraj.seed().direction();
129 
130  if (seedplus)
131  LogDebug("CosmicTrackFinder")<<"Reconstruction along momentum ";
132  else
133  LogDebug("CosmicTrackFinder")<<"Reconstruction opposite to momentum";
134 
135  /*
136  // === the convention is to save always final tracks with hits sorted *along* momentum
137  */
138 
140  //it->recHitsV(thits);
141  theTraj.recHitsV(thits,useHitsSplitting_);
143  recHits.reserve(thits.size());
144 
145  // reverse hit order
146  for (Trajectory::RecHitContainer::const_iterator hitIt = thits.end()-1;
147  hitIt >= thits.begin(); hitIt--) {
148  recHits.push_back( (**hitIt).hit()->clone());
149  }
150 
151  TSOS firstState;
152  unsigned int firstId;
153 
154  firstState=theTraj.lastMeasurement().updatedState();
155  firstId = theTraj.lastMeasurement().recHit()->geographicalId().rawId();
156 
157  /*
158  cout << "firstState y, z: " << firstState.globalPosition().y()
159  << " , " << firstState.globalPosition().z() << endl;
160 
161  */
162 
164  TSOS startingState( firstState.localParameters(), LocalTrajectoryError(C),
165  firstState.surface(),
166  firstState.magneticField() );
167 
168  // protection againt invalid initial states
169  if (! firstState.isValid()) {
170  edm::LogWarning("CosmicTrackFinder") << "invalid innerState, will not make TrackCandidate";
172  return;
173  }
174 
175  if(firstId != recHits.front().geographicalId().rawId()){
176  edm::LogWarning("CosmicTrackFinder") <<"Mismatch in DetID of first hit: firstID= " <<firstId
177  << " DetId= " << recHits.front().geographicalId().rawId();
179  return;
180  }
181 
182  PTrajectoryStateOnDet const & state = trajectoryStateTransform::persistentState( startingState, firstId);
183 
184 
185  output->push_back(TrackCandidate(recHits,theTraj.seed(),state,theTraj.seedRef() ) );
186 
187  }
188 
189  }
191  }
#define LogDebug(id)
T getParameter(std::string const &) const
const LocalTrajectoryParameters & localParameters() const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
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:45
void push_back(D *&d)
Definition: OwnVector.h:273
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:85
CRackTrajectoryBuilder crackTrajectoryBuilder_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
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.
T const * product() const
Definition: Handle.h:74
char state
Definition: procUtils.cc:75
const Surface & surface() const
DetId geographicalId() const
edm::ParameterSet conf_
reference front()
Definition: OwnVector.h:348
void reserve(size_t)
Definition: OwnVector.h:267

Member Data Documentation

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

Definition at line 83 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

CosmicTrajectoryBuilder cms::CosmicTrackFinder::cosmicTrajectoryBuilder_
private

Definition at line 81 of file CosmicTrackFinder.h.

Referenced by produce().

CRackTrajectoryBuilder cms::CosmicTrackFinder::crackTrajectoryBuilder_
private

Definition at line 82 of file CosmicTrackFinder.h.

Referenced by produce().

std::string cms::CosmicTrackFinder::geometry
private
bool cms::CosmicTrackFinder::trinevents
private

Definition at line 85 of file CosmicTrackFinder.h.

bool cms::CosmicTrackFinder::useHitsSplitting_
private

Definition at line 86 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().