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 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
33 
37 
40 
44 
48 
52 
53 //
54 // class declaration
55 //
56 
58  public:
61  void beginRun(const edm::Run&, const edm::EventSetup&) override;
62  void produce(edm::Event&, const edm::EventSetup&) override;
63  private:
64 
69  double ptcut_;
70  // ----------member data ---------------------------
71 };
72 
73 //
74 // constants, enums and typedefs
75 //
76 
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
86 {
87  inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection"); ptcut_= iConfig.getParameter< double >("TrackPt");
88 
89  produces< DetIdCollection >() ;
90  // TrackAssociator parameters
91  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
92  parameters_.loadParameters( parameters );
94 
95 }
96 
97 
99 {
100 
101  // do anything here that needs to be done at desctruction time
102  // (e.g. close files, deallocate resources etc.)
103 
104 }
105 
106 
107 //
108 // member functions
109 //
110 
111 void
113 {
114  edm::ESHandle<CaloTopology> theCaloTopology;
115  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
116  caloTopology_ = &(*theCaloTopology);
117 }
118 
119 // ------------ method called to produce the data ------------
120 void
122 {
123  using namespace edm;
124  using reco::TrackCollection;
125 // if(!iSetup) continue;
126  Handle<TrackCollection> tkTracks;
127  iEvent.getByLabel(inputCollection_,tkTracks);
128  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
129  for(TrackCollection::const_iterator itTrack = tkTracks->begin();
130  itTrack != tkTracks->end();
131  ++itTrack) {
132  if(itTrack->pt()>ptcut_){
134  if(info.crossedEcalIds.size()==0) break;
135 
136  if(info.crossedEcalIds.size()>0){
137  DetId centerId = info.crossedEcalIds.front();
138 
140  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
141  for ( std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id )
142  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id)
143  == interestingDetIdCollection->end())
144  interestingDetIdCollection->push_back(*id);
145  }
146  }
147 
148  }
149  iEvent.put(interestingDetIdCollection);
150 
151 }
152 //define this as a plug-in
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
static const TGPicture * info(bool iBackgroundIsBlack)
#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:116
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
Definition: DetId.h:18
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:41
void beginRun(const edm::Run &, const edm::EventSetup &) override