13 using namespace muonisolation;
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());
51 for (mu = muons.begin(); mu != muEnd; ++
mu) {
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();
188 double dz = muon.
dz();
201 if (fixVxy && fixVz) {
205 if (
pow(muon.
dxy(), 2) < 4 * errd02) {
211 if (
pow(muon.
dsz(), 2) < 4 * errdsz2) {
217 if (
pow(muon.
dxy(), 2) < 4 * errd02) {
226 if (
pow(muon.
dsz(), 2) < 4 * errdsz2) {
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);
254 double tantheta =
tan(theta);
256 z += deltas /
tan(theta);
267 if (fabs(eta) > 1.479)
double qoverp() const
q / p
double p() const
momentum vector magnitude
double theta() const
polar angle
constexpr T normalizedPhi(T phi)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
std::vector< CaloTower >::const_iterator const_iterator
Geom::Theta< T > theta() const
double phi() const
azimuthal angle of momentum vector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
double dsz() const
dsz parameter (THIS IS NOT the SZ impact parameter to (0,0,0) if refPoint is far from (0...
bool getData(T &iHolder) const
double eta() const
pseudorapidity of momentum vector
CovarianceMatrix covariance() const
return track covariance matrix
double pt() const
track transverse momentum
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())
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double vy() const
y coordinate of the reference point on track
int charge() const
track electric charge
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Power< A, B >::type pow(const A &a, const B &b)
double vx() const
x coordinate of the reference point on track
double eta() const final
momentum pseudorapidity