17 : theCaloTowerCollectionToken(
19 theDepositLabel(par.getUntrackedParameter<
string>(
"DepositLabel")),
22 theWeight_E(par.getParameter<double>(
"Weight_E")),
23 theWeight_H(par.getParameter<double>(
"Weight_H")),
24 theThreshold_E(par.getParameter<double>(
"Threshold_E")),
25 theThreshold_H(par.getParameter<double>(
"Threshold_H")),
26 theDR_Veto_E(par.getParameter<double>(
"DR_Veto_E")),
27 theDR_Veto_H(par.getParameter<double>(
"DR_Veto_H")),
28 theDR_Max(par.getParameter<double>(
"DR_Max")),
29 vertexConstraintFlag_XY(par.getParameter<
bool>(
"Vertex_Constraint_XY")),
30 vertexConstraintFlag_Z(par.getParameter<
bool>(
"Vertex_Constraint_Z")) {}
45 TrackCollection::const_iterator
mu;
46 TrackCollection::const_iterator muEnd(
muons.end());
52 for (cal =
towers->begin(); cal != calEnd; ++cal) {
54 double dEta = fabs(
mu->eta() - cal->eta());
62 double etecal = cal->emEt();
63 double eecal = cal->emEnergy();
65 double ethcal = cal->hadEt();
66 double ehcal = cal->hadEnergy();
68 if ((!doEcal) && (!doHcal))
71 DetId calId = cal->id();
89 LogDebug(
"Muon|RecoMuon|L2MuonIsolationProducer")
90 <<
" >>> Muon: pt " <<
muon.pt() <<
" eta " <<
muon.eta() <<
" phi " <<
muon.phi();
102 for (cal =
towers->begin(); cal != calEnd; ++cal) {
104 double dEta = fabs(
muon.eta() - cal->eta());
112 double etecal = cal->emEt();
113 double eecal = cal->emEnergy();
115 double ethcal = cal->hadEt();
116 double ehcal = cal->hadEnergy();
118 if ((!doEcal) && (!doHcal))
121 DetId calId = cal->id();
135 dep.addCandEnergy(calodep);
136 LogDebug(
"Muon|RecoMuon|L2MuonIsolationProducer")
137 <<
" >>> Calo deposit inside veto (with ECAL): deltar " <<
deltar <<
" calodep " << calodep <<
" ecaldep " 138 << etecal <<
" hcaldep " << ethcal <<
" eta " << cal->eta() <<
" phi " << cal->phi();
144 LogDebug(
"Muon|RecoMuon|L2MuonIsolationProducer")
145 <<
" >>> Calo deposit inside veto (no ECAL): deltar " <<
deltar <<
" calodep " <<
theWeight_H * ethcal
146 <<
" eta " << cal->eta() <<
" phi " << cal->phi();
152 LogDebug(
"Muon|RecoMuon|L2MuonIsolationProducer")
153 <<
" >>> Deposits belongs to other track: deltar, etecal, ethcal= " <<
deltar <<
", " << etecal <<
", " 164 LogDebug(
"Muon|RecoMuon|L2MuonIsolationProducer")
165 <<
" >>> Calo deposit (with ECAL): deltar " <<
deltar <<
" calodep " << calodep <<
" ecaldep " << etecal
166 <<
" hcaldep " << ethcal <<
" eta " << cal->eta() <<
" phi " << cal->phi();
171 LogDebug(
"Muon|RecoMuon|L2MuonIsolationProducer")
172 <<
" >>> Calo deposit (no ECAL): deltar " <<
deltar <<
" calodep " <<
theWeight_H * ethcal <<
" eta " 173 << cal->eta() <<
" phi " << cal->phi();
183 double qoverp =
muon.qoverp();
184 double cur = bz *
muon.charge() /
muon.pt();
185 double phi0 =
muon.phi();
186 double dca =
muon.dxy();
201 if (fixVxy && fixVz) {
204 double errd02 =
muon.covariance(
muon.i_dxy,
muon.i_dxy);
205 if (
pow(
muon.dxy(), 2) < 4 * errd02) {
207 cur -=
muon.dxy() *
muon.covariance(
muon.i_dxy,
muon.i_qoverp) / errd02 * (cur / qoverp);
210 double errdsz2 =
muon.covariance(
muon.i_dsz,
muon.i_dsz);
211 if (
pow(
muon.dsz(), 2) < 4 * errdsz2) {
216 double errd02 =
muon.covariance(
muon.i_dxy,
muon.i_dxy);
217 if (
pow(
muon.dxy(), 2) < 4 * errd02) {
219 cur -=
muon.dxy() *
muon.covariance(
muon.i_dxy,
muon.i_qoverp) / errd02 * (cur / qoverp);
225 double errdsz2 =
muon.covariance(
muon.i_dsz,
muon.i_dsz);
226 if (
pow(
muon.dsz(), 2) < 4 * errdsz2) {
229 cur -=
muon.dsz() *
muon.covariance(
muon.i_dsz,
muon.i_qoverp) / errdsz2 * (cur / qoverp);
235 double sphi0 =
sin(phi0);
236 double cphi0 =
cos(phi0);
238 double xsin = endpos.
x() * sphi0 - endpos.
y() * cphi0;
239 double xcos = endpos.
x() * cphi0 + endpos.
y() * sphi0;
240 double fcdca = fabs(1 - cur * dca);
241 double phif = atan2(fcdca * sphi0 - cur * endpos.
x(), fcdca * cphi0 + cur * endpos.
y());
242 double tphif2 =
tan(0.5 * (phif - phi0));
243 double dcaf = dca + xsin + xcos * tphif2;
245 double x = endpos.
x() - dcaf *
sin(phif);
246 double y = endpos.
y() + dcaf *
cos(phif);
248 double deltas = (
x -
muon.vx()) * cphi0 + (y -
muon.vy()) * sphi0;
251 deltas = deltas * deltaphi /
sin(deltaphi);
267 if (fabs(
eta) > 1.479)
Geom::Phi< T > phi() const
constexpr T normalizedPhi(T phi)
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
std::vector< CaloTower >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)