CMS 3D CMS Logo

IsolatedEcalPixelTrackCandidateProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: IsolatedEcalPixelTrackCandidateProducer
4 // Class: IsolatedEcalPixelTrackCandidateProducer
5 //
13 //
14 // Original Author: Ruchi Gupta
15 // Created: Thu Feb 11 17:21:58 MSD 2014
16 // $Id: IsolatedEcalPixelTrackCandidateProducer.cc,v 1.0 2014/02/11 22:25:52 wmtan Exp $
17 //
18 //
19 
20 //#define EDM_ML_DEBUG
21 // system include files
22 #include <memory>
23 
24 // user include files
25 
31 
33 
34 //#define EDM_ML_DEBUG
35 
37  : tok_ee(consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EERecHitSource"))),
38  tok_eb(consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EBRecHitSource"))),
39  tok_trigcand(consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("filterLabel"))),
41  coneSizeEta0_(conf.getParameter<double>("EcalConeSizeEta0")),
42  coneSizeEta1_(conf.getParameter<double>("EcalConeSizeEta1")),
43  hitCountEthrEB_(conf.getParameter<double>("EBHitCountEnergyThreshold")),
44  hitEthrEB_(conf.getParameter<double>("EBHitEnergyThreshold")),
45  fachitCountEE_(conf.getParameter<double>("EEFacHitCountEnergyThreshold")),
46  hitEthrEE0_(conf.getParameter<double>("EEHitEnergyThreshold0")),
47  hitEthrEE1_(conf.getParameter<double>("EEHitEnergyThreshold1")),
48  hitEthrEE2_(conf.getParameter<double>("EEHitEnergyThreshold2")),
49  hitEthrEE3_(conf.getParameter<double>("EEHitEnergyThreshold3")) {
50  // register the products
51  produces<reco::IsolatedPixelTrackCandidateCollection>();
52 }
53 
55 
58  desc.add<edm::InputTag>("filterLabel", edm::InputTag("hltIsolPixelTrackL2Filter"));
59  desc.add<edm::InputTag>("EBRecHitSource", edm::InputTag("hltEcalRecHit", "EcalRecHitsEB"));
60  desc.add<edm::InputTag>("EERecHitSource", edm::InputTag("hltEcalRecHit", "EcalRecHitsEE"));
61  desc.add<double>("EBHitEnergyThreshold", 0.10);
62  desc.add<double>("EBHitCountEnergyThreshold", 0.5);
63  desc.add<double>("EEHitEnergyThreshold0", -41.0664);
64  desc.add<double>("EEHitEnergyThreshold1", 68.7950);
65  desc.add<double>("EEHitEnergyThreshold2", -38.1483);
66  desc.add<double>("EEHitEnergyThreshold3", 7.04303);
67  desc.add<double>("EEFacHitCountEnergyThreshold", 10.0);
68  desc.add<double>("EcalConeSizeEta0", 0.09);
69  desc.add<double>("EcalConeSizeEta1", 0.14);
70  descriptions.add("isolEcalPixelTrackProd", desc);
71 }
72 
73 // ------------ method called to produce the data ------------
76  const edm::EventSetup& iSetup) const {
77 #ifdef EDM_ML_DEBUG
78  edm::LogVerbatim("HcalIsoTrack") << "==============Inside IsolatedEcalPixelTrackCandidateProducer";
79 #endif
80  const CaloGeometry* geo = &iSetup.getData(tok_geom_);
81 
83  iEvent.getByToken(tok_eb, ecalEB);
84 
86  iEvent.getByToken(tok_ee, ecalEE);
87 #ifdef EDM_ML_DEBUG
88  edm::LogVerbatim("HcalIsoTrack") << "ecal Collections isValid: " << ecalEB.isValid() << "/" << ecalEE.isValid();
89 #endif
90 
92  iEvent.getByToken(tok_trigcand, trigCand);
93 
94  std::vector<edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
95  trigCand->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
96  int nCand = isoPixTrackRefs.size();
97 
98  auto iptcCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
99 #ifdef EDM_ML_DEBUG
100  edm::LogVerbatim("HcalIsoTrack") << "coneSize_ " << coneSizeEta0_ << "/" << coneSizeEta1_ << " hitCountEthrEB_ "
101  << hitCountEthrEB_ << " hitEthrEB_ " << hitEthrEB_ << " fachitCountEE_ "
102  << fachitCountEE_ << " hitEthrEE " << hitEthrEE0_ << ":" << hitEthrEE1_ << ":"
103  << hitEthrEE2_ << ":" << hitEthrEE3_;
104 #endif
105  for (int p = 0; p < nCand; p++) {
106  int nhitIn(0), nhitOut(0);
107  double inEnergy(0), outEnergy(0);
108  std::pair<double, double> etaPhi(isoPixTrackRefs[p]->track()->eta(), isoPixTrackRefs[p]->track()->phi());
109  if (isoPixTrackRefs[p]->etaPhiEcalValid())
110  etaPhi = isoPixTrackRefs[p]->etaPhiEcal();
111  double etaAbs = std::abs(etaPhi.first);
112  double coneSize_ = (etaAbs > 1.5) ? coneSizeEta1_ : (coneSizeEta0_ * (1.5 - etaAbs) + coneSizeEta1_ * etaAbs) / 1.5;
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("HcalIsoTrack") << "Track: eta/phi " << etaPhi.first << "/" << etaPhi.second
115  << " pt:" << isoPixTrackRefs[p]->track()->pt() << " cone " << coneSize_ << "\n"
116  << "rechit size EB/EE : " << ecalEB->size() << "/" << ecalEE->size()
117  << " coneSize_: " << coneSize_;
118 #endif
119  if (etaAbs < 1.7) {
120  int nin(0), nout(0);
121  for (auto eItr : *(ecalEB.product())) {
122  const GlobalPoint& pos = geo->getPosition(eItr.detid());
123  double R = reco::deltaR(pos.eta(), pos.phi(), etaPhi.first, etaPhi.second);
124  if (R < coneSize_) {
125  nhitIn++;
126  inEnergy += (eItr.energy());
127  ++nin;
128  if (eItr.energy() > hitCountEthrEB_)
129  nhitOut++;
130  if (eItr.energy() > hitEthrEB_) {
131  outEnergy += (eItr.energy());
132  ++nout;
133  }
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("HcalIsoTrack") << "EBRechit close to the track has E " << eItr.energy()
136  << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R;
137 #endif
138  }
139  }
140  }
141  if (etaAbs > 1.25) {
142  int nin(0), nout(0);
143  for (auto eItr : *(ecalEE.product())) {
144  const GlobalPoint& pos = geo->getPosition(eItr.detid());
145  double R = reco::deltaR(pos.eta(), pos.phi(), etaPhi.first, etaPhi.second);
146  if (R < coneSize_) {
147  double eta = std::abs(pos.eta());
148  double hitEthr = (((eta * hitEthrEE3_ + hitEthrEE2_) * eta + hitEthrEE1_) * eta + hitEthrEE0_);
149  if (hitEthr < hitEthrEB_)
150  hitEthr = hitEthrEB_;
151  nhitIn++;
152  inEnergy += (eItr.energy());
153  ++nin;
154  if (eItr.energy() > fachitCountEE_ * hitEthr)
155  nhitOut++;
156  if (eItr.energy() > hitEthr) {
157  outEnergy += (eItr.energy());
158  ++nout;
159  }
160 #ifdef EDM_ML_DEBUG
161  edm::LogVerbatim("HcalIsoTrack") << "EERechit close to the track has E " << eItr.energy()
162  << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R;
163 #endif
164  }
165  }
166  }
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("HcalIsoTrack") << "nhitIn:" << nhitIn << " inEnergy:" << inEnergy << " nhitOut:" << nhitOut
169  << " outEnergy:" << outEnergy;
170 #endif
171  reco::IsolatedPixelTrackCandidate newca(*isoPixTrackRefs[p]);
172  newca.setEnergyIn(inEnergy);
173  newca.setEnergyOut(outEnergy);
174  newca.setNHitIn(nhitIn);
175  newca.setNHitOut(nhitOut);
176  iptcCollection->push_back(newca);
177  }
178 #ifdef EDM_ML_DEBUG
179  edm::LogVerbatim("HcalIsoTrack") << "ncand:" << nCand << " outcollction size:" << iptcCollection->size();
180 #endif
181  iEvent.put(std::move(iptcCollection));
182 }
edm::StreamID
Definition: StreamID.h:30
IsolatedEcalPixelTrackCandidateProducer::tok_trigcand
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_trigcand
Definition: IsolatedEcalPixelTrackCandidateProducer.h:35
reco::IsolatedPixelTrackCandidate::setNHitIn
void setNHitIn(int a)
Definition: IsolatedPixelTrackCandidate.h:151
IsolatedEcalPixelTrackCandidateProducer::hitEthrEE1_
const double hitEthrEE1_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:43
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
nin
int nin
Definition: CascadeWrapper.h:114
edm::SortedCollection< EcalRecHit >
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
trigger::TriggerTrack
Definition: TriggerTypeDefs.h:87
reco::IsolatedPixelTrackCandidate
Definition: IsolatedPixelTrackCandidate.h:23
IsolatedEcalPixelTrackCandidateProducer::hitEthrEE0_
const double hitEthrEE0_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:42
reco::IsolatedPixelTrackCandidate::setEnergyOut
void setEnergyOut(double a)
Definition: IsolatedPixelTrackCandidate.h:147
edm::Handle
Definition: AssociativeIterator.h:50
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:590
reco::IsolatedPixelTrackCandidate::setNHitOut
void setNHitOut(int a)
Definition: IsolatedPixelTrackCandidate.h:155
IsolatedEcalPixelTrackCandidateProducer::coneSizeEta0_
const double coneSizeEta0_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:37
CaloGeometry
Definition: CaloGeometry.h:21
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:70
IsolatedEcalPixelTrackCandidateProducer::tok_ee
const edm::EDGetTokenT< EcalRecHitCollection > tok_ee
Definition: IsolatedEcalPixelTrackCandidateProducer.h:33
IsolatedEcalPixelTrackCandidateProducer::coneSizeEta1_
const double coneSizeEta1_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:38
Point3DBase< float, GlobalTag >
IsolatedEcalPixelTrackCandidateProducer::hitEthrEE2_
const double hitEthrEE2_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:44
IsolatedEcalPixelTrackCandidateProducer::hitEthrEE3_
const double hitEthrEE3_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:45
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
deltaR.h
nout
int nout
Definition: CascadeWrapper.h:114
iEvent
int iEvent
Definition: GenABIO.cc:224
IsolatedEcalPixelTrackCandidateProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: IsolatedEcalPixelTrackCandidateProducer.cc:74
IsolatedEcalPixelTrackCandidateProducer::IsolatedEcalPixelTrackCandidateProducer
IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet &)
Definition: IsolatedEcalPixelTrackCandidateProducer.cc:36
IsolatedEcalPixelTrackCandidateProducer::tok_geom_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
reco::IsolatedPixelTrackCandidate::setEnergyIn
void setEnergyIn(double a)
Definition: IsolatedPixelTrackCandidate.h:143
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
IsolatedEcalPixelTrackCandidateProducer.h
DDAxes::phi
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
IsolatedEcalPixelTrackCandidateProducer::fachitCountEE_
const double fachitCountEE_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:41
eostools.move
def move(src, dest)
Definition: eostools.py:511
Ref.h
IsolatedEcalPixelTrackCandidateProducer::~IsolatedEcalPixelTrackCandidateProducer
~IsolatedEcalPixelTrackCandidateProducer() override
Definition: IsolatedEcalPixelTrackCandidateProducer.cc:54
DetId.h
IsolatedEcalPixelTrackCandidateProducer::hitEthrEB_
const double hitEthrEB_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:40
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
EventSetup.h
reco::deltaR
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
IsolatedEcalPixelTrackCandidateProducer::hitCountEthrEB_
const double hitCountEthrEB_
Definition: IsolatedEcalPixelTrackCandidateProducer.h:39
trigger
Definition: HLTPrescaleTableCond.h:8
IsolatedEcalPixelTrackCandidateProducer::tok_eb
const edm::EDGetTokenT< EcalRecHitCollection > tok_eb
Definition: IsolatedEcalPixelTrackCandidateProducer.h:34
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
dttmaxenums::R
Definition: DTTMax.h:29
edm::InputTag
Definition: InputTag.h:15
IsolatedEcalPixelTrackCandidateProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: IsolatedEcalPixelTrackCandidateProducer.cc:56