CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Skim_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  inputCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter< edm::InputTag >("inputCollection"));
88  ptcut_= iConfig.getParameter< double >("TrackPt");
89 
90  produces< DetIdCollection >() ;
91  // TrackAssociator parameters
92  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
94  parameters_.loadParameters( parameters, iC );
96 
97 }
98 
99 
101 {
102 
103  // do anything here that needs to be done at desctruction time
104  // (e.g. close files, deallocate resources etc.)
105 
106 }
107 
108 
109 //
110 // member functions
111 //
112 
113 void
115 {
116  edm::ESHandle<CaloTopology> theCaloTopology;
117  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
118  caloTopology_ = &(*theCaloTopology);
119 }
120 
121 // ------------ method called to produce the data ------------
122 void
124 {
125  using namespace edm;
126  using reco::TrackCollection;
127 // if(!iSetup) continue;
128  Handle<TrackCollection> tkTracks;
129  iEvent.getByToken(inputCollectionToken_,tkTracks);
130  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
131  for(TrackCollection::const_iterator itTrack = tkTracks->begin();
132  itTrack != tkTracks->end();
133  ++itTrack) {
134  if(itTrack->pt()>ptcut_){
136  if(info.crossedEcalIds.size()==0) break;
137 
138  if(info.crossedEcalIds.size()>0){
139  DetId centerId = info.crossedEcalIds.front();
140 
142  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
143  for ( std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id )
144  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id)
145  == interestingDetIdCollection->end())
146  interestingDetIdCollection->push_back(*id);
147  }
148  }
149 
150  }
151  iEvent.put(interestingDetIdCollection);
152 
153 }
154 //define this as a plug-in
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
static const TGPicture * info(bool iBackgroundIsBlack)
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
#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:13
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
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:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
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
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
Definition: Run.h:41
void beginRun(const edm::Run &, const edm::EventSetup &) override