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
 

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)
 
- 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 69 of file CosmicTrackFinder.h.

Member Typedef Documentation

Definition at line 72 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, and edm::ParameterSet::getUntrackedParameter().

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

Definition at line 39 of file CosmicTrackFinder.cc.

39 { }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 42 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(), and patCandidatesForDimuonsSequences_cff::tracker.

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

Member Data Documentation

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

Definition at line 84 of file CosmicTrackFinder.h.

Referenced by CosmicTrackFinder(), and produce().

CosmicTrajectoryBuilder cms::CosmicTrackFinder::cosmicTrajectoryBuilder_
private

Definition at line 82 of file CosmicTrackFinder.h.

Referenced by produce().

CRackTrajectoryBuilder cms::CosmicTrackFinder::crackTrajectoryBuilder_
private

Definition at line 83 of file CosmicTrackFinder.h.

Referenced by produce().

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

Definition at line 86 of file CosmicTrackFinder.h.