CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackCandidateTopBottomHitFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TrackCandidateTopBottomHitFilter
4 // Class: TrackCandidateTopBottomHitFilter
5 //
13 //
14 // Original Author: Giuseppe Cerati
15 // Created: Tue Sep 9 09:47:01 CEST 2008
16 // $Id: TrackCandidateTopBottomHitFilter.cc,v 1.3 2010/02/20 21:01:23 wmtan Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
28 
31 
34 
38 
39 //
40 // class decleration
41 //
42 
44 public:
47 
48 private:
49  virtual void beginRun(edm::Run & run, const edm::EventSetup&) ;
50  virtual void produce(edm::Event&, const edm::EventSetup&);
51  virtual void endJob() ;
54  std::string builderName;
55  double seedY;
56 };
57 
59  builderName = iConfig.getParameter<std::string>("TTRHBuilder");
60  label = iConfig.getParameter<edm::InputTag>("Input");
61  seedY = iConfig.getParameter<double>("SeedY");
62 
63  produces<TrackCandidateCollection>();
64 }
65 
66 
68 
69 
70 //
71 // member functions
72 //
73 
74 // ------------ method called to produce the data ------------
76  using namespace edm;
77  using namespace std;
78 
80  iEvent.getByLabel(label,pIn);
81  std::auto_ptr<TrackCandidateCollection> pOut(new TrackCandidateCollection);
82  for (TrackCandidateCollection::const_iterator it=pIn->begin(); it!=pIn->end();++it) {
83  PTrajectoryStateOnDet state = it->trajectoryStateOnDet();
84  TrackCandidate::range oldhits = it->recHits();
85  TrajectorySeed seed = it->seed();
87  for (TrackCandidate::RecHitContainer::const_iterator hit=oldhits.first;hit!=oldhits.second;++hit) {
88  if (hit->isValid()) {
89  double hitY = theBuilder->build(&*hit)->globalPosition().y();
90  if (seedY*hitY>0) hits.push_back(hit->clone());
91  else break;
92  } else hits.push_back(hit->clone());
93  }
94  if (hits.size()>=3) {
95  TrackCandidate newTC(hits,seed,state);
96  pOut->push_back(newTC);
97  }
98  }
99  iEvent.put(pOut);
100 }
101 
104 }
105 
107 
108 //define this as a plug-in
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< TrackCandidate > TrackCandidateCollection
size_type size() const
Definition: OwnVector.h:247
std::pair< const_iterator, const_iterator > range
virtual void beginRun(edm::Run &run, const edm::EventSetup &)
void push_back(D *&d)
Definition: OwnVector.h:273
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
TrackCandidateTopBottomHitFilter(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::ESHandle< TransientTrackingRecHitBuilder > theBuilder
const T & get() const
Definition: EventSetup.h:55
char state
Definition: procUtils.cc:75
Definition: Run.h:33