CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HighPtTrackEcalDetIdProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HighPtTrackEcalDetIdProducer
4 // Class: HighPtTrackEcalDetIdProducer
5 //
6 /*\class HighPtTrackEcalDetIdProducer HighPtTrackEcalDetIdProducer.cc
7 
8  Description: [one line class summary]
9 
10  Implementation:
11  [Notes on implementation]
12 */
13 //
14 // Original Author: Jie Chen
15 // Created: Mon Apr 12 16:41:46 CDT 2010
16 // $Id: HighPtTrackEcalDetIdProducer.cc,v 1.2 2013/02/27 22:47:59 wmtan Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
34 
38 
41 
45 
49 
53 
54 //
55 // class declaration
56 //
57 
59  public:
62  void beginRun(const edm::Run&, const edm::EventSetup&) override;
63  void produce(edm::Event&, const edm::EventSetup&) override;
64  private:
65 
70  double ptcut_;
71  // ----------member data ---------------------------
72 };
73 
74 //
75 // constants, enums and typedefs
76 //
77 
78 
79 //
80 // static data member definitions
81 //
82 
83 //
84 // constructors and destructor
85 //
87 {
88  inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection"); ptcut_= iConfig.getParameter< double >("TrackPt");
89 
90  produces< DetIdCollection >() ;
91  // TrackAssociator parameters
92  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
93  parameters_.loadParameters( parameters );
95 
96 }
97 
98 
100 {
101 
102  // do anything here that needs to be done at desctruction time
103  // (e.g. close files, deallocate resources etc.)
104 
105 }
106 
107 
108 //
109 // member functions
110 //
111 
112 void
114 {
115  edm::ESHandle<CaloTopology> theCaloTopology;
116  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
117  caloTopology_ = &(*theCaloTopology);
118 }
119 
120 // ------------ method called to produce the data ------------
121 void
123 {
124  using namespace edm;
125  using reco::TrackCollection;
126 // if(!iSetup) continue;
127  Handle<TrackCollection> tkTracks;
128  iEvent.getByLabel(inputCollection_,tkTracks);
129  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
130  for(TrackCollection::const_iterator itTrack = tkTracks->begin();
131  itTrack != tkTracks->end();
132  ++itTrack) {
133  if(itTrack->pt()>ptcut_){
135  if(info.crossedEcalIds.size()==0) break;
136 
137  if(info.crossedEcalIds.size()>0){
138  DetId centerId = info.crossedEcalIds.front();
139 
141  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
142  for ( std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id )
143  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id)
144  == interestingDetIdCollection->end())
145  interestingDetIdCollection->push_back(*id);
146  }
147  }
148 
149  }
150  iEvent.put(interestingDetIdCollection);
151 
152 }
153 //define this as a plug-in
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< DetId > crossedEcalIds
HighPtTrackEcalDetIdProducer(const edm::ParameterSet &)
void useDefaultPropagator()
use the default propagator
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
Definition: DetId.h:20
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const T & get() const
Definition: EventSetup.h:55
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDCollection< DetId > DetIdCollection
void loadParameters(const edm::ParameterSet &)
Definition: Run.h:36
void beginRun(const edm::Run &, const edm::EventSetup &) override