CMS 3D CMS Logo

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 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
32 
36 
39 
43 
47 
51 
52 //
53 // class declaration
54 //
55 
57 public:
60  void beginRun(const edm::Run&, const edm::EventSetup&) override;
61  void produce(edm::Event&, const edm::EventSetup&) override;
62 
63 private:
68  double ptcut_;
69  // ----------member data ---------------------------
70 };
71 
72 //
73 // constants, enums and typedefs
74 //
75 
76 //
77 // static data member definitions
78 //
79 
80 //
81 // constructors and destructor
82 //
84  inputCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputCollection"));
85  ptcut_ = iConfig.getParameter<double>("TrackPt");
86 
87  produces<DetIdCollection>();
88  // TrackAssociator parameters
89  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
91  parameters_.loadParameters(parameters, iC);
93 }
94 
96  // do anything here that needs to be done at desctruction time
97  // (e.g. close files, deallocate resources etc.)
98 }
99 
100 //
101 // member functions
102 //
103 
105  edm::ESHandle<CaloTopology> theCaloTopology;
106  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
107  caloTopology_ = &(*theCaloTopology);
108 }
109 
110 // ------------ method called to produce the data ------------
112  using namespace edm;
113  using reco::TrackCollection;
114  // if(!iSetup) continue;
115  Handle<TrackCollection> tkTracks;
116  iEvent.getByToken(inputCollectionToken_, tkTracks);
117  std::unique_ptr<DetIdCollection> interestingDetIdCollection(new DetIdCollection());
118  for (TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack) {
119  if (itTrack->pt() > ptcut_) {
122  if (info.crossedEcalIds.empty())
123  break;
124 
125  if (!info.crossedEcalIds.empty()) {
126  DetId centerId = info.crossedEcalIds.front();
127 
130  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
131  for (std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id)
132  if (std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id) ==
133  interestingDetIdCollection->end())
134  interestingDetIdCollection->push_back(*id);
135  }
136  }
137  }
138  iEvent.put(std::move(interestingDetIdCollection));
139 }
140 //define this as a plug-in
T getParameter(std::string const &) const
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< DetId > crossedEcalIds
HighPtTrackEcalDetIdProducer(const edm::ParameterSet &)
void useDefaultPropagator()
use the default propagator
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
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:19
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
HLT enums.
T get() const
Definition: EventSetup.h:73
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDCollection< DetId > DetIdCollection
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
void beginRun(const edm::Run &, const edm::EventSetup &) override