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");
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)
134  interestingDetIdCollection->push_back(*id);
135  }
136  }
137  }
139 }
140 //define this as a plug-in
TrackExtra.h
Handle.h
EDProducer.h
ESHandle.h
TrackDetectorAssociator.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:120
CaloTopology::getWindow
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:64
HighPtTrackEcalDetIdProducer::~HighPtTrackEcalDetIdProducer
~HighPtTrackEcalDetIdProducer() override
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:95
EBDetId.h
EEDetId.h
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
CaloTopology
Definition: CaloTopology.h:19
EcalRecHitCollections.h
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
DetId
Definition: DetId.h:17
MakerMacros.h
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HighPtTrackEcalDetIdProducer::inputCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:64
ecaldqm::topology
const CaloTopology * topology(nullptr)
edm::ESHandle< CaloTopology >
TrackAssociatorParameters::loadParameters
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: TrackAssociatorParameters.cc:18
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
HighPtTrackEcalDetIdProducer::HighPtTrackEcalDetIdProducer
HighPtTrackEcalDetIdProducer(const edm::ParameterSet &)
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:83
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
TrackDetectorAssociator
Definition: TrackDetectorAssociator.h:49
CaloTopologyRecord.h
iEvent
int iEvent
Definition: GenABIO.cc:224
HighPtTrackEcalDetIdProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:104
HighPtTrackEcalDetIdProducer::parameters_
TrackAssociatorParameters parameters_
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:67
edm::EventSetup
Definition: EventSetup.h:57
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
TrackDetectorAssociator::InsideOut
Definition: TrackDetectorAssociator.h:55
DetId::Ecal
Definition: DetId.h:27
get
#define get
HighPtTrackEcalDetIdProducer
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:56
EcalRecHit.h
CaloTopology.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CaloSubdetectorTopology.h
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:14
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
DetIdCollection
edm::EDCollection< DetId > DetIdCollection
Definition: DetIdCollection.h:7
HighPtTrackEcalDetIdProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:111
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
edm::EDProducer
Definition: EDProducer.h:36
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:154
HighPtTrackEcalDetIdProducer::ptcut_
double ptcut_
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:68
ParameterSet.h
edm::Event
Definition: Event.h:73
HighPtTrackEcalDetIdProducer::caloTopology_
const CaloTopology * caloTopology_
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:65
TrackAssociatorParameters.h
interestingDetIdCollectionProducer_cfi.interestingDetIdCollection
interestingDetIdCollection
Definition: interestingDetIdCollectionProducer_cfi.py:11
HighPtTrackEcalDetIdProducer::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: Skim_HighPtTrackEcalDetIdProducer.cc:66
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
DetIdCollection.h
TrackDetMatchInfo.h
TrackAssociatorParameters
Definition: TrackAssociatorParameters.h:34